Skip to content

Instantly share code, notes, and snippets.

@hpsaturn
Created February 4, 2021 00:48
Show Gist options
  • Save hpsaturn/970920e8731897200c64554f3a3f52ed to your computer and use it in GitHub Desktop.
Save hpsaturn/970920e8731897200c64554f3a3f52ed to your computer and use it in GitHub Desktop.
Micropython Raspberry Pico - Temperature test
import machine
import utime
sensor = machine.ADC(4)
factor = 3.3 / (65355)
led = machine.Pin(25,machine.Pin.OUT)
while True:
read = sensor.read_u16() * factor
temp = 27 - (read - 0.706)/0.001721
print (temp)
led.toggle()
utime.sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment