from machine import Pin, I2C, PWM, ADC
from utime import sleep, sleep_ms
pot= ADC(Pin(33))
def map_value(value, in_min, in_max, out_min, out_max):
return (value - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
while True:
lectura_pot = pot.read_u16()
ppm = map_value(lectura_pot, 0, 65535, 200, 10000)
print("ppm: {:.0f}".format(ppm))