Created
June 18, 2013 06:48
-
-
Save electronut/5803155 to your computer and use it in GitHub Desktop.
blinking an LED with Raspberry Pi. LED is connected on pin 18 (GPIO5)
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
# blinking an LED with Raspberry Pi. LED is connected on pin 18 (GPIO5) | |
# | |
# run this as: | |
# sudo python test.py | |
# | |
# electronut.in | |
import time | |
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setup(18, GPIO.OUT) | |
while True: | |
try: | |
GPIO.output(18, True) | |
time.sleep(0.5) | |
GPIO.output(18, False) | |
time.sleep(0.5) | |
except: | |
print 'exiting...' | |
# off | |
GPIO.output(18, False) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment