【RPi PICO】读取内部温度传感器

树莓派 PICO 和 RP2040 相关应用讨论
回复
头像
shaoziyang
帖子: 3956
注册时间: 2019年 10月 21日 13:48

【RPi PICO】读取内部温度传感器

#1

帖子 shaoziyang »

RP2040带有一个内部温度传感器,它使用了ADC的通道4,数字并不是温度,而是需要进行转换。

代码: 全选

temperature = 27 - (reading - 0.706)/0.001721
官方给出的完整的转换程序:

Code: Select all

import machine
import utime
sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / (65535)
while True:
reading = sensor_temp.read_u16() * conversion_factor
temperature = 27 - (reading - 0.706)/0.001721
print(temperature)
utime.sleep(2)
 

回复

  • 随机主题
    回复总数
    阅读次数
    最新文章