我将LilyPad 温度传感器连接到LilyPad Arduino 328 主板,目的是读取相当准确的环境温度读数。传感器正在接收电源并给出我能够通过串行读取的响应。
我面临的问题是从传感器读取的数据非常不寻常——尽管数字一致。我正在读取模拟传感器输入并转换为这样的电压......
loop(){
float therm;
therm = analogRead(2); // Read from sensor through Analog 2
therm *= (5.0/1024.0); // 5 volts / 1024 units of analog resolution
delay(100);
}
这会产生大约 1.1 伏的一致读数,传感器文档表明,当真实环境温度约为 23 度时,环境温度约为 60 摄氏度。该传感器不靠近任何其他电子设备,因此我无法预见这是问题所在。
我读取传感器的代码不正确吗?我的传感器可能有故障吗?