LCD shield -Analog input A0 changes value continuously
we have tried recieve analog values a0 port in lcd shield http://www.robotshop.com/en/dfrobot-lcd-keypad-shield-arduino.html
the value changes when connect new components arduino , therefore have update our program coding (if statement). there way configure input values buttons digital values instead of analog values, alt, use other analog ports (a1, a2, a3, a4, a5)
thank reading, , hope can us.
while(beslut==1)//så länge select knappen inte är intryckt
{
if(counter=!0)
{
delay(3000);
counter--;
}
x=analogread(0);
lcd.setcursor(10,0); // set cursor to
lcd.print(x); // print text on lcd
if(x>6300)//selcet knappen har tryckts in
{
if(svar_fran_spelare>=0){
beslut=0;}
}
if(x<1010 && x>990)//upp knappen
{
svar_fran_spelare++;
lcd.setcursor(12,1);
lcd.print(svar_fran_spelare);
}
if(x<2700 && x>2400)//ner knappen
{
/*if(svar_fran_spelare==0)
{
continue;
}*/
svar_fran_spelare--;
lcd.setcursor(12,1);
lcd.print(svar_fran_spelare);
}
}
the value changes when connect new components arduino , therefore have update our program coding (if statement). there way configure input values buttons digital values instead of analog values, alt, use other analog ports (a1, a2, a3, a4, a5)
thank reading, , hope can us.
while(beslut==1)//så länge select knappen inte är intryckt
{
if(counter=!0)
{
delay(3000);
counter--;
}
x=analogread(0);
lcd.setcursor(10,0); // set cursor to
lcd.print(x); // print text on lcd
if(x>6300)//selcet knappen har tryckts in
{
if(svar_fran_spelare>=0){
beslut=0;}
}
if(x<1010 && x>990)//upp knappen
{
svar_fran_spelare++;
lcd.setcursor(12,1);
lcd.print(svar_fran_spelare);
}
if(x<2700 && x>2400)//ner knappen
{
/*if(svar_fran_spelare==0)
{
continue;
}*/
svar_fran_spelare--;
lcd.setcursor(12,1);
lcd.print(svar_fran_spelare);
}
}
quote
the value changes when connect new components arduino
sounds using "default" vcc (+5volt) reference... increasing load may dropping supply voltage , giving incorrect/fluctuating a/d readings. if have dvm, measure +5 after voltage regulator variations.... better, use dc o'scope if available.
ray
Arduino Forum > Using Arduino > Displays > LCD shield -Analog input A0 changes value continuously
arduino
Comments
Post a Comment