Pi-WiringPi-Exemple-Quick2Wire-Install

De MCHobby - Wiki
Révision datée du 30 septembre 2013 à 09:50 par Admin (discussion | contributions) (Page créée avec « {{Pi-WiringPi-NAV}} == Intro == {{bloc-etroit|text=Once I’d soldered it and checked to make sure no solder bridges, etc. I plugged it in to do some testing. The main boa... »)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Sauter à la navigation Sauter à la recherche


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

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.