我希望我的LCD显示“Voltage=(传感器Value)”,但现在,我获得该方案承认这一价值的唯一途径是,如果我把它 put在一旁的话。 但是,当我把它放入一个坡道时,整个屏幕上填满了1、2、3、4或5个,取决于立立强计的地点。
If I don t have it in a loop then whatever setting the potentiometer is on is what will pop on the screen and will not change if potentiometer is turned.
我怎么能够把休闲结果置于休闲之外,以便我能够“(Voltage=传感器Value)”?
Here s my program:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
void setup()
{
lcd.init();
lcd.backlight();
int sensorPin = A0;
int sensorValue = 0;
sensorValue = 0.004882812 * analogRead(sensorPin) + 1;
lcd.print("Voltage=");
}
void loop()
{
int sensorPin = A0;
int sensorValue = 0;
sensorValue = 0.004882812 * analogRead(sensorPin) + 1;
lcd.print(sensorValue);
}