Document
![17025158-0957c5faf2c8b8d5.gif](https://i-blog.csdnimg.cn/blog_migrate/27d1256552f1618ed387f55197dedbb3.webp?x-image-process=image/format,png)
热敏电阻
这个模块可以让获得周围的环境温度。在使用它之前,建议将板子置于冷却下再采集,否则读取的温度和周围的温度有偏差,因为板子会发热,所以它的周围的影响最大的热源是板子自身的温度,所以环境的温度就会变成板子的温度
所以在板子还没开始发热之前,起初获取的一定是环境温度,后来才逐渐变成板子温度
示例代码
from microbit import *
while True:
temp = temperature() # get temperature ℃
print(temp)
display.scroll(str(temp))
sleep(10000)
实测效果
-
led面板显示的内容
-
print打印出来的数据
- 温度枪实测的温度
![17025158-cc2477f2ea930895.jpg](https://i-blog.csdnimg.cn/blog_migrate/e046beab2f026811e11ee1dedcc4cd25.webp?x-image-process=image/format,png)
![17025158-c7a04ec75c92c157.png](https://i-blog.csdnimg.cn/blog_migrate/ae82d54c50c5d2024226b660a26dcce9.webp?x-image-process=image/format,png)
smile.png