Create light.py

This commit is contained in:
tpollina 2019-12-13 10:49:19 -08:00 committed by GitHub
parent 61ec2fd6b7
commit 7141c117e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

19
scripts/light.py Normal file
View 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)