Created
November 20, 2012 06:41
-
-
Save maditnerd/4116427 to your computer and use it in GitHub Desktop.
exempleerreurmagpi1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Code officiel du MagPi | |
#!/usr/bin/python | |
import time | |
import RPi.GPIO as GPIO | |
#Il manque une ligne pour que ça marche GPIO.setmode(GPIO.BCM) | |
GPIO.setup(11, GPIO.IN) | |
while True: | |
mybutton = GPIO.input(11) | |
if mybutton == False: #Indentation incorrecte | |
print "giggle" | |
time.sleep(.2) | |
#Code fonctionnel | |
#!/usr/bin/python | |
import time | |
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BCM) #Sans cette declaration ça ne marche pas | |
GPIO.setup(11, GPIO.IN) | |
while True: | |
mybutton = GPIO.input(11) | |
if mybutton == False: | |
print "giggle" | |
time.sleep(.2) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment