Create light.py
This commit is contained in:
parent
61ec2fd6b7
commit
7141c117e7
19
scripts/light.py
Normal file
19
scripts/light.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
import RPi.GPIO as GPIO
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
GPIO.setmode(GPIO.BCM)
|
||||||
|
GPIO.setwarnings(False)
|
||||||
|
|
||||||
|
state = int(sys.argv[1])
|
||||||
|
|
||||||
|
|
||||||
|
def light(state):
|
||||||
|
|
||||||
|
if state == "on":
|
||||||
|
GPIO.output(21,GPIO.HIGH)
|
||||||
|
if state == "off":
|
||||||
|
GPIO.output(21,GPIO.LOW)
|
||||||
|
|
||||||
|
light(state)
|
Loading…
Reference in a new issue