planktoscope/scripts/light.py

20 lines
291 B
Python
Raw Normal View History

2019-12-13 19:49:19 +01:00
#!/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)