import machine
import time
from math import log


tem_sensor_pin = machine.ADC(28)
photo_sensor_pin = machine.ADC(27)

BETA = 3950
RANGE = (2**16) -1
GAMMA = 0.7
RL10 = 50
photo_perv = 0
tem_perv = 0
BETA = 3950

while True:




    lux_value = photo_sensor_pin.read_u16()
    voltage = lux_value / RANGE * 5
    resistance = 2000 * voltage / (1 - voltage / 5)
    lux = pow(RL10 * 1e3 * pow(10, GAMMA) / resistance, (1 / GAMMA))


    analogValue = tem_sensor_pin.read_u16()
    celsius = 1 / (log(1 / (RANGE / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15




    if tem_perv != celsius:
        tem_perv = celsius
        print("The Tempreture Is :", celsius)

    
    if photo_perv != lux:
        photo_perv = lux
        print("The Intensity Is :", lux)


    
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT