Skip to content

Instantly share code, notes, and snippets.

@maditnerd
Created November 20, 2012 06:41
Show Gist options
  • Save maditnerd/4116427 to your computer and use it in GitHub Desktop.
Save maditnerd/4116427 to your computer and use it in GitHub Desktop.
exempleerreurmagpi1
#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