Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO # import the GPIO module
- GPIO.setmode(GPIO.BCM) # sets the mode to BCM (meaning that pin 17 refers to th$
- GPIO.setup(17, GPIO.OUT) # marks pin 17 as an output pin
- GPIO.output(17, True) # sets pin 17 to true. Since pin 17 (GPIO 11) is marked a$
- # you can just ignore this try except block, it is essentially the same as 'pau$
- try:
- foobar = input("press enter to exit")
- except SyntaxError:
- pass
- GPIO.output(17, False) # turns pin 17 back off
- #note, you must have your LED properly connectect your LED to pin 17 (GPIO 11)
- #also, you MUST run this script as root. you can do this byy typing the followi$
- # 'cd [wherever you saved this script]'
- # 'sudo python gpio-test.py'
- #this should run the script. If this does not work, post on the schoology threa$
Advertisement
Add Comment
Please, Sign In to add comment