Pi/led.py

22 lines
310 B
Python
Raw Normal View History

2015-12-23 20:09:52 +00:00
#!/usr/bin/python
from time import sleep
import RPi.GPIO as GPIO
2015-12-31 13:11:37 +00:00
pin = 14
2015-12-23 20:09:52 +00:00
try:
GPIO.setmode(GPIO.BCM)
2015-12-31 13:11:37 +00:00
GPIO.setup(pin, GPIO.OUT)
2015-12-23 20:09:52 +00:00
while True:
2015-12-31 13:11:37 +00:00
GPIO.output(pin, 1)
2015-12-23 20:09:52 +00:00
sleep(1)
2015-12-31 13:11:37 +00:00
GPIO.output(pin, 0)
2015-12-23 20:09:52 +00:00
sleep(1)
except KeyboardInterrupt:
2016-01-18 11:51:11 +00:00
pass
2015-12-23 20:09:52 +00:00
finally:
GPIO.cleanup()