Pi-WiringPi-Exemple-Quick2Wire-Install
Intro
Once I’d soldered it and checked to make sure no solder bridges, etc. I plugged it in to do some testing.
The main board has an LED and a button and these can be optionally jumpered into the GPIO pins. The two jumper links next to the LED and button need to be present to use them.
To test, make sure wiringPi est installé
Tester le module principal
The button is connected to pin 0 and the LED to pin 1 du GPIO. The button is wired so that the input reads 1 when you push the button.
Placer les cavalier de façon a rendre la LED et le bouton fonctionnel. Ensuite:
gpio mode 0 in # Button pin 0 gpio mode 1 out # LED pin 1 while true; do gpio write 1 `gpio read 0`; done
Pushing the button should light the LED. If not, then check each one individually:
gpio write 1 1 # LED on gpio write 1 0 # LED off
and for the button:
gpio read 0
should return 1 when you push the button, otherwise 0.
At the bottom of the main board is the external GPIO connector as well as some power and ground pins. The GPIO outputs have series resistors, so can be connected directly to LEDs – I connected an LED between 0v and pin7.
Source: wiringPi.com
Exécutez ensuite le code suivant:
gpio mode 7 out while true; do gpio write 7 `gpio read 0`; done
and used the button to toggle the LED on pin 7 in the same way as above.
Source: WiringPi.com. WiringPi est une libraire sous licence GPL écrite par Gordon Henderson. Crédit: wiringpi.com
Traduit de l'anglais par Meurisse D. pour MCHobby.be
Traduit avec l'accord de Gordon Henderson, créateur de wiringPi - Translated with authorization of Gordon Henderson, creator of wiringPi
Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : « Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.
L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.