Skip to content

Instantly share code, notes, and snippets.

Created February 26, 2021 10:51
What would you like to do?
This is sample code for Read and Log Internal Temperature Data in Raspberry Pi Pico to .txt file tutorial.
import machine
import utime
sensor_temp = machine.ADC(machine.ADC.CORE_TEMP)
conversion_factor = 3.3 / (65535)
file = open("temps.txt", "w")
while True:
reading = sensor_temp.read_u16() * conversion_factor
temperature = 27 - (reading - 0.706)/0.001721
file.write(str(temperature) + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment