"""
Chip para manejar el sensor TMP36:
https://wokwi.com/projects/399501357273611265
OJO:
https://docs.wokwi.com/chips-api/analog
Currently, the reference voltage for all the virtual ADCs
is 5 volts(regardless of the MCU)!!!!!!!!!
A 25ºC el voltaje leído debe ser 0.750 V
"""
from machine import Pin, ADC
from time import sleep
# Sensor conectado al GPIO14
SENSOR = ADC(Pin(14))
while True:
lectura = SENSOR.read_u16()
# Voltaje incorrecto
voltaje_3V3 = lectura*3.3/65535
# Voltaje correcto poniendo Vref=5V
voltaje_5V = lectura*5/65535
print(voltaje_3V3, "\t", voltaje_5V)
sleep(1)