from machine import Pin
import time
import dht
from machine import ADC
ledR=Pin(4,Pin.OUT)
ledY=Pin(5,Pin.OUT)
ledG=Pin(6,Pin.OUT)
sensor1=dht.DHT22(Pin(22))
sensor2=dht.DHT22(Pin(21))
sensor3=dht.DHT22(Pin(20))
sensor4=dht.DHT22(Pin(19))
light1=ADC(28)
light2=ADC(27)
while True:
sensor1.measure()
t1=sensor1.temperature()
h1=sensor1.humidity()
dhaw=light1.read_u16()
print(dhaw*(100/65007))
print("coin 1",t1,h1)
sensor2.measure()
t2=sensor2.temperature()
h2=sensor2.humidity()
print("coin 2",t2,h2)
sensor3.measure()
t3=sensor3.temperature()
h3=sensor3.humidity()
print("coin 3",t3,h3)
sensor4.measure()
t4=sensor4.temperature()
h4=sensor4.humidity()
print("coin 4",t4,h4)
if(0<=h1<=30):
ledG.on()
ledR.off()
ledY.off()
elif(30<=h1<=60):
ledG.off()
ledR.off()
ledY.on()
else:
ledG.off()
ledR.on()
ledY.off()
time.sleep(5)
Loading
pi-pico-w
pi-pico-w