Issue with input and display password
hey there all,
i'm pretty new arduino , c++ programming, please forgive me if in wrong place.
i having issue when trying input code buttons on ebay lcd keypad shield on "funduino" mega
the program designed sit idle until select key pressed. once happens, prompts 8 character code, displays code , moves on next function.
the issue i'm having when enter key, populates code key, , displays odd character afterwards.
i have modified different project suit needs, , works satisfaction except this.
any appreciated,
thanks!
*edit* pics of password error



i'm pretty new arduino , c++ programming, please forgive me if in wrong place.
i having issue when trying input code buttons on ebay lcd keypad shield on "funduino" mega
the program designed sit idle until select key pressed. once happens, prompts 8 character code, displays code , moves on next function.
the issue i'm having when enter key, populates code key, , displays odd character afterwards.
i have modified different project suit needs, , works satisfaction except this.
any appreciated,
thanks!
code: [select]
if (button == btnselect)
{
tone(52, 880, 90);
lcd.clear();
lcd.setcursor(0,0);
lastdebouncetime = millis(); //set current time
lcd.print("enter code");
while (currentlength < 8)
{
lcd.setcursor(currentlength + 4, 1);
lcd.cursor();
int button = read_lcd_buttons();
if ( (millis() - lastdebouncetime) > debouncedelay)
button == btnnone;
if (button != btnnone)
{
tone(52, 880, 90);
if ((button != btnselect))
{
lcd.print(button);
password[currentlength] = button;
currentlength++;
lastdebouncetime = millis(); //set current time
}
}
}
if (currentlength == 8)
{
delay(1000);
lcd.nocursor();
lcd.clear();
lcd.home();
lcd.print("entered: ");
lcd.setcursor(4,1);
tone(52, 880, 200);
delay(300);
tone(52, 660, 200);
lcd.print(password[0]);
lcd.print(password[1]);
lcd.print(password[2]);
lcd.print(password[3]);
lcd.print(password[4]);
lcd.print(password[5]);
lcd.print(password[6]);
lcd.print(password[7]);
tone(1319, 200);
delay(3000);
lcd.clear();
currentlength = 0;
lcd.print("click on '5'");
lcd.clear();
}
*edit* pics of password error



i tried have @ code.
it hard understand going on.
i have suggestions:
1) spend time in formatting of code
2) place more of code. , add comment
things may problem:
1) intial value of currentlength? maybe not zero
2) debouncedelay may not large enough. try ridiculously long. try 1000, make sure logic in code correct or not.
nothing else comes mind @ moment.
it hard understand going on.
i have suggestions:
1) spend time in formatting of code
2) place more of code. , add comment
things may problem:
1) intial value of currentlength? maybe not zero
2) debouncedelay may not large enough. try ridiculously long. try 1000, make sure logic in code correct or not.
nothing else comes mind @ moment.
Arduino Forum > Using Arduino > Programming Questions > Issue with input and display password
arduino
Comments
Post a Comment