led.py turn on/off led
This commit is contained in:
parent
4741c39b86
commit
68ddbc881a
16
py/led.py
Normal file
16
py/led.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import RPi.GPIO as GPIO
|
||||||
|
import time
|
||||||
|
|
||||||
|
LED_PIN = 17
|
||||||
|
|
||||||
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
GPIO.setup(LED_PIN, GPIO.OUT)
|
||||||
|
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
GPIO.output(LED_PIN, GPIO.HIGH)
|
||||||
|
time.sleep(1)
|
||||||
|
GPIO.output(LED_PIN, GPIO.LOW)
|
||||||
|
time.sleep(1)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
GPIO.cleanup()
|
||||||
Loading…
x
Reference in New Issue
Block a user