Description
Related Tags
from ptpma.components import PMALightSensor, PMABuzzer
from time import sleep

light_sensor = PMALightSensor("A1")
buzzer = PMABuzzer("D2")

while True:
    print(light_sensor.reading)
    sleep(0.1)
    if light_sensor.reading >400:
        buzzer.on()
        print ("Too bright!")
    else:
        buzzer.off()
        print ("Light level OK")