# Obtain Temperature Data From on Board Temperature Sensor of Raspberry Pi Pico
# Uses MicroPython
# This does not work in Wokwi simulation...
#
# Source:
# https://www.instructables.com/Obtain-Temperature-Data-From-on-Board-Temperature-/
import machine
import utime
sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / (65535)
while True:
reading = sensor_temp.read_u16() * conversion_factor
temperature = 27 - (reading - 0.706)/0.001721
print("Temperature: {}".format(temperature))
utime.sleep(2)