import time
time.sleep(0.1) # Wait for USB to become ready
print("Hello, Pi Pico!")
from Lights import *
from Sensors import *
class SensorLight(DimLight, AnalogSensor):
def __init__(self, lightpin, sensorpin, name):
DimLight.__init__(self, lightpin, name + " light")
AnalogSensor.__init__(self, sensorpin, name + " sensor")
def operate(self):
v = self.rawValue()
brightness = int(v / 255)
self.setBrightness(brightness)
l = SensorLight(lightpin =8, sensorpin = 27, name = 'Bathroom')
while True:
l.operate()
time.sleep(0.5)