blinking led on gpio port 4
This commit is contained in:
parent
133c13738f
commit
88b11438de
1 changed files with 23 additions and 0 deletions
23
led.py
Executable file
23
led.py
Executable file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
import RPi.GPIO as GPIO
|
||||||
|
|
||||||
|
print 'blah'
|
||||||
|
|
||||||
|
try:
|
||||||
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
GPIO.setup(4, GPIO.OUT)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
GPIO.output(4, 1)
|
||||||
|
sleep(1)
|
||||||
|
GPIO.output(4, 0)
|
||||||
|
sleep(1)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
GPIO.output(4, 0)
|
||||||
|
finally:
|
||||||
|
GPIO.cleanup()
|
||||||
|
|
||||||
|
print 'end'
|
Loading…
Reference in a new issue