how to display three digit input on a 16,2 lcd via 4x4 kepad

Hi all,

I'm new to coding so any help will be appreciated, i trying to input a 3 digit number eg.(file# nnn) via a 4x4 keypad and then want to display it on a 16,2 lcd display. I can't find an example anywhere and all i can manage code wise is to input 1 digit and display 1 digit........

void setup() {

lcd.begin(16,2);
lcd.setCursor(2,0);
lcd.print("ENTER FILE #");

}
void loop(){

char keypressed = mykeypad.getKey();
if(keypressed !=NO_KEY){
lcd.setCursor(6,1);
lcd.print(keypressed);

Please help !!

This might help?

The example you supplied won’t compile. Also read the forum stickies about how to correctly post code in between code tags [​code][/​code], which can be added via the </> button on the menu.

Here’s a few hints about one way to build up a multi-digit number. You’ll need to think about where to insert them in the working version of your supplied code...

int num = 0;

.....

num = num * 10 + (keypressed - '0');
lcd.print(num);

You can store three key press into a string and then convert it to int. See keypad password example to know how to read multiple keys