# input value from keypad and store

iam beginer and i have some poor problem maybe
and LCD 16x2

void c(){
if (key){
if ( key == 48 )key=0; // conversi variable ‘0’ ke 0
lcd.clear();
dtKey = dtKey*10+key;
lcd.print(dtKey);

if(key == ‘C’ ){ // clear data = tekan c;
lcd.clear();
dtKey=0; key = 0;
lcd.print(dtKey);
}
if(key == ‘#’ ){
ppmLimit=dtKey;
lcd.clear();
lcd.print(“Data Telah Masuk”);
}
if(key == ‘D’ ){
lcd.clear();
dtKey=0; key=0;
lcd.begin(16, 2);
lcd.setCursor(1, 0);
lcd.print(“SetPpmLimit :”);
}
if(key == ‘A’ ){
lcd.clear();
lcd.print(“NoCode”);
}
if(key == ‘B’ ){
lcd.print(“NoCode”);
}
if(key == ‘*’ ){
lcd.setCursor(0, 0); //baris pertama
lcd.print(“ppmLimit :”);lcd.print(ppmLimit);
if(ECcurrent<=150){
lcd.setCursor(0, 1); //baris kedua
lcd.print(“CurrentPpm :”);lcd.print(“Idle”);
}
else{
lcd.setCursor(0, 1); //baris kedua
lcd.print(“CurrentPpm :”);lcd.print(ECcurrent,0);
}
}
}

}

i got code like that, ,if i run the code it run well but 1 problem is if i press 111 and want store it it will be 1145, the last number of 1 is change by 45,so i decided to test all number from 0-9 and the result is all my number have another value than it self . The value for each number is
0 = 35
1 = 45
2 = 55
3 = 65
4 = 75
5 = 85
6 = 95
7 = 105
8 = 115
9 = 125

how to fix this ??
so if i press 111 it still 111 not 1145
thx for helping~

how to fix this ??

With a text editor!!

There are serious problems with that snippet. You add to dtKey regardless of which key is pressed. If the C key is pressed, you add some nonsense value to dtKey. Why would you do THAT?

You specifically convert the '0' to 0, but do not do similar conversion for '1', '2', '3', etc. Why not?

Do NOT post snippets again. Do NOT post code in quote tags. Read the stickies at the top of the forum and post ALL of your code CORRECTLY.