Created
January 8, 2014 02:45
-
-
Save adamhunter/8310922 to your computer and use it in GitHub Desktop.
python gpio script to blink led
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
# import the library that allows us to logically access the GPIO pins | |
# refer to the library as GPIO, it is like an alias | |
import RPi.GPIO as GPIO | |
import time | |
# use the BCIM numbering scheme | |
GPIO.setmode(GPIO.BCM) | |
# set pin 18 to be in output mode | |
GPIO.setup(18, GPIO.OUT) | |
run = True | |
while(run): | |
try: | |
GPIO.output(18, GPIO.HIGH) | |
time.sleep(.5) | |
GPIO.output(18, GPIO.LOW) | |
time.sleep(.5) | |
except KeyboardInterrupt: | |
run = False | |
GPIO.cleanup() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment