Raspberry-LED : Différence entre versions

De DiouxX's Wiki
Aller à : navigation, rechercher
(Code)
m (Ajout des sources)
 
Ligne 23 : Ligne 23 :
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
== Sources ==
 +
* http://thepihut.com/blogs/raspberry-pi-tutorials/27968772-turning-on-an-led-with-your-raspberry-pis-gpio-pins
  
 
[[Catégorie:GPIO]]
 
[[Catégorie:GPIO]]

Version actuelle datée du 26 novembre 2015 à 13:56

Ce script permet d'allumer et etéindre une LED connecté au GPIO du Raspberry

Schéma


Raspberry-LED.png


Code

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)

print "LED on"
GPIO.output(18,GPIO.HIGH)

time.sleep(5)

print "LED off"
GPIO.output(18,GPIO.LOW)

Sources