Created
February 4, 2021 00:48
-
-
Save hpsaturn/970920e8731897200c64554f3a3f52ed to your computer and use it in GitHub Desktop.
Micropython Raspberry Pico - Temperature test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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