0

I am doing a project that requires input from a keypad to be displayed on the LCD display.

lcd.print() displays in proper form, but when the I press characters on the keypad, they are overwritten as weird symbols.

Any help would be appreciated.

Here's the code:

void setup()
{
  Serial.begin(9600);
  Serial.println("LCD test with PWM contrast adjustment");
  pinMode(13,OUTPUT);
  analogWrite(6,Contrast);

  lcd.begin(16,2);

  pinMode(buzzer, OUTPUT);
  lcd.print(" Electronic ");
  Serial.print(" Electronic ");
  lcd.setCursor(0,1);
  lcd.print(" Keypad Lock ");
  Serial.print(" Keypad Lock ");
  delay(2000);
  lcd.clear();
  lcd.print("Enter Ur Passkey:");
  Serial.println("Enter Ur Passkey:");
  lcd.setCursor(1,0);
  for(int j=0;j<4;j++)
    EEPROM.write(j, j+49);
  for(int j=0;j<4;j++)
    pass[j]=EEPROM.read(j);
}
  • So, where in your code are you working with a keypad? I don't see a single line that would have anything to do with a keypad. – AnT Apr 29 at 20:49
0

I think you should use 48 instead of 49.

48 is the ASCII symbol of 0. If you add a number from 0-9 to it, than you get the ASCII symbols of '0' to '9'.

(and a small sidenote: Enter Ur Passkey: is more than 16 characters; also it is more 'professional not to make slang texts to try to fit it, why not using Enter Passkey: instead?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.