from machine import Pin, ADC
import time
pot = ADC(Pin(33))
pot.atten(ADC.ATTN_11DB)
#pot.width(ADC.WIDTH_10BIT)
while True:
reading = pot.read_u16()
dos= pot.read_uv()
volt= dos/1000000
print("ADC: ",reading, dos, volt)
time.sleep_ms(500)
def map(value, in_min, in_max, out_min, out_max):
return (value - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
result = map(50, 0, 100, 0, 255) # Result is 127.5
print(result)