from machine import Pin, ADC
from math import log
from time import sleep
NTC1 = ADC(Pin(13))
NTC2 = ADC(Pin(14))
led1 = Pin(12,Pin.OUT)
led2 = Pin(27,Pin.OUT)
led1.value(0)
led2.value(0)
BETA = 3950
while True:
analogValue1 = NTC1.read()
celsius1 = 1 / (log(1 / (4095. / analogValue1 - 1)) / BETA + 1.0 / 298.15) - 273.15
s = celsius1
analogValue2 = NTC2.read()
celsius2 = 1 / (log(1 / (4095. / analogValue2 - 1)) / BETA + 1.0 / 298.15) - 273.15
v = celsius2
print(s,v)
sleep(0.5)
if s < 5 and v > 20:
led1.value(1)
elif s > 20 or v < 20:
led1.value(0)