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.println("LCD test with PWM contrast adjustment");


  pinMode(buzzer, OUTPUT);
  lcd.print(" Electronic ");
  Serial.print(" Electronic ");
  lcd.print(" Keypad Lock ");
  Serial.print(" Keypad Lock ");
  lcd.print("Enter Ur Passkey:");
  Serial.println("Enter Ur Passkey:");
  for(int j=0;j<4;j++)
    EEPROM.write(j, j+49);
  for(int j=0;j<4;j++)
  • 1
    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. Apr 29, 2019 at 20:49

2 Answers 2


stick to one type of variable, to prevent mix-up

So if you stick to a byte (uint8_t) type for keypad:

uint8_t keys[4][3] = {
  {0xF,0xA,0xB}                 // F-*  B-#

then you can save it to your EEPROM as a byte and read it as a byte.it will prevent mix-up. your code which you are not displaying (everybody here can write one of those faster then to download it from here)already translate numbers to numbers and then you are growing them to symbols with higher value


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 and acknowledge you have read our privacy policy.

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