Last active
February 11, 2019 21:31
-
-
Save bunchc/cb9d6289d4bd15ab72d2a80afc3004bc to your computer and use it in GitHub Desktop.
There Are Door Lights - Light Sensor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gpiozero import LightSensor | |
import hub_ctrl | |
sensor = LightSensor(4) | |
print(sensor.light_detected) | |
while True: | |
# sensor.when_light = hub_ctrl.send_command(listing=True, busnum=1, devnum=2, hub=None, port=2, value=1, verbose=False) | |
sensor.wait_for_light() | |
hub_ctrl.send_command(listing=True, busnum=1, devnum=2, hub=None, port=2, value=1, verbose=False) | |
#sensor.when_dark = hub_ctrl.send_command(listing=True, busnum=1, devnum=2, hub=None, port=2, value=0, verbose=False) | |
sensor.wait_for_dark() | |
hub_ctrl.send_command(listing=True, busnum=1, devnum=2, hub=None, port=2, value=0, verbose=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment