mardi 27 janvier 2015

python syntax error with if/else statement

hey I need help with a stupid syntax error using the if and else statement.



GNU nano 2.2.6
#!/usr/bin/python

print 'ACTIVATED'

import RPi.GPIO as GPIO ## Import GPIO library

GPIO.setmode(GPIO.BOARD) ## Use board pin numbering
GPIO.setup(40, GPIO.IN) ## Setup GPIO Pin 40 to OUT
GPIO.input(40) ## Turn on GPIO pin 40
for x in xrange(10):
if: GPIO.input(40)
print ('CHEESE')
else:
GPIO.cleanup()


heres the error:



File "./gid.py", line 12
if: GPIO.input(40)
^

Aucun commentaire:

Enregistrer un commentaire