|
各位老师,大家好,本想使用arduino的A0端口测一个光纤的模拟量输出值,但还没有接任何外设,A0就有值,图1所示,最后A0值稳定在了1.56左右,可这样的话,加上光纤传感器1~5V的范围,就超过了arduino可监测的区间,请问各位老师,怎样才能使得未接外设前的A0值为0呢?
我的监测代码是这样的: - [code]
- int sensorValue = 0;
- float float_sensorValue = 0;
- void setup() {
- // put your setup code here, to run once:
- Serial.begin(9600);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- sensorValue = analogRead(A0);
- float_sensorValue = (float)sensorValue/1023*5.00;
- Serial.println(float_sensorValue,2);
- delay(1000);
- }
复制代码 [/code]
在此谢过各位大虾~ |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|