Skip to content

Instantly share code, notes, and snippets.

Created February 26, 2021 10:51
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save suadanwar/8e9cc1fc329bff78ed4d8fa89061dc15 to your computer and use it in GitHub Desktop.
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