from machine import Pin, ADC
import dht
import time
from Detector import *

suhu = dht.DHT22(Pin(13))

kelembaban = ADC(Pin(12))
kelembaban.width(ADC.WIDTH_10BIT)
kelembaban.atten(ADC.ATTN_11DB)

BUZZER = Pin(25, Pin.OUT)

while True:

    humidity = kelembaban.read()
    suhu.measure()
    temperature = suhu.temperature()
    print(f"Nilai Kelembaban: {humidity}")
    print(f"Nilai Temperature: {temperature}")
    dtc = Detector(temperature, humidity, BUZZER)
    print(dtc.execute())
    dtc.buzz()
    time.sleep(0.1)