Advertisement
belrey10

8 – Pico Temperature Reader

Nov 7th, 2024
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | Source Code | 0 0
  1. from machine import ADC
  2. import time
  3. adc = machine.ADC(4)
  4. while True:
  5.     ADC_voltage = adc.read_u16() * (3.3 / (65536))
  6.     temperature_celcius = 27 - (ADC_voltage - 0.706)/0.001721
  7.     temp_fahrenheit=32+(1.8*temperature_celcius)
  8.     print("Temperature: {}°C {}°F".format(temperature_celcius,temp_fahrenheit))
  9.     time.sleep_ms(500)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement