“热敏电阻”的版本间的差异
来自Labplus盛思维基百科
Tangliufeng(讨论 | 贡献) |
Tangliufeng(讨论 | 贡献) |
||
第21行: | 第21行: | ||
== 使用教程 == | == 使用教程 == | ||
− | + | ||
− | === Arduino示例 === | + | === <small>Arduino示例</small> === |
− | === | + | === <small>Python示例</small> === |
<pre style="color:blue"> | <pre style="color:blue"> | ||
from microbit import * | from microbit import * | ||
第32行: | 第32行: | ||
return 1/(math.log(1023/pin.read_analog() - 1)/3955 + 1/298) - 273 #将采样的温度模拟量转化为摄氏度 | return 1/(math.log(1023/pin.read_analog() - 1)/3955 + 1/298) - 273 #将采样的温度模拟量转化为摄氏度 | ||
− | |||
while True: | while True: | ||
print('NTC:',getNTC(pin2)) | print('NTC:',getNTC(pin2)) | ||
第38行: | 第37行: | ||
</pre> | </pre> | ||
− | === 图形化示例 === | + | === <small>图形化示例</small> === |
+ | [[File:热敏电阻_图形化.png|600px|center]] |
2018年3月14日 (三) 09:39的版本
概述
热敏电阻随温度升高而增大,可用于测量环境温度变化。
技术参数
- 工作电压:VCC 3.3-5V
- 温度范围-10~100℃
- 模块尺寸:24x46x7.5mm
引脚定义
VCC | 电源 |
NC | 空脚 |
AO | 输出温度模拟量 |
GND | 地 |
使用教程
Arduino示例
Python示例
from microbit import * import math display.off() def getNTC(pin): return 1/(math.log(1023/pin.read_analog() - 1)/3955 + 1/298) - 273 #将采样的温度模拟量转化为摄氏度 while True: print('NTC:',getNTC(pin2)) sleep(1000)