added led.py script
This commit is contained in:
17
rpi/timer/led.py
Normal file
17
rpi/timer/led.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import grovepi
|
||||||
|
import time
|
||||||
|
|
||||||
|
LED = 2 # Digital port D2
|
||||||
|
grovepi.pinMode(LED, "OUTPUT")
|
||||||
|
|
||||||
|
def on():
|
||||||
|
grovepi.digitalWrite(LED, 1)
|
||||||
|
|
||||||
|
|
||||||
|
def off():
|
||||||
|
grovepi.digitalWrite(LED, 0)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
on()
|
||||||
|
time.sleep(1)
|
||||||
|
off()
|
||||||
Reference in New Issue
Block a user