from machine import Pin, ADC, PWM
from time import sleep

print("Hello, ESP32!")
sensor = ADC(15)
sensor.atten(ADC.ATTN_11DB)

L1 = Pin(32, Pin.OUT)
In1 = Pin(2, Pin.IN, Pin.PULL_UP)



while True:

    val = sensor.read()
    duty = int(val /4)



    if sensor.read() > 1861 and sensor.read() < 3102 :
        L1.on()
    else:
        L1.off()
    print("Potenciometro: ", val, "; pwm Duty:", duty )
    sleep(0.1)