First thing is first, we are not here to do the work for you. We are here to teach you and help you solve your own problem.
Secondly, I'm pretty sure you mean 57 when you press 9.
Why would it do this? Well think about it, if you pressed 'a' how is that letter sent. Anything and everything you type as "text" will have each and every character converted into a binary number. Luckily, there is a well known standard. Try searching "ASCII" in google.
Lastly, put your code in code tags Like this, select your code and press the </> button
Ps991:
First thing is first, we are not here to do the work for you. We are here to teach you and help you solve your own problem.
Secondly, I'm pretty sure you mean 57 when you press 9.
Why would it do this? Well think about it, if you pressed 'a' how is that letter sent. Anything and everything you type as "text" will have each and every character converted into a binary number. Luckily, there is a well known standard. Try searching "ASCII" in google.
Lastly, put your code in code tags Like this, select your code and press the </> button
yes you are right i searched for ascii but how to make it not reading the binary codes i have tried a lot but nothing if you could get me a tip
byte number = 0;
if(key >= '0' && key <= '9') //make sure key is actually a number
number = key - '0';
BOOM, done...
This works because 9 and '9' are not the same. 9 is an integer. '9' is a character in ASCII, which translates to the integer 57. So if you pressed 9 and get 57, then subtracting '0' (or 48) gives you 57 - 48 = 9 (as an integer).
Ps991:
It is actually a lot easier than you think.
byte number = 0;
if(key >= '0' && key <= '9') //make sure key is actually a number
number = key - '0';
BOOM, done...
This works because 9 and '9' are not the same. 9 is an integer. '9' is a character in ASCII, which translates to the integer 57. So if you pressed 9 and get 57, then subtracting '0' (or 48) gives you 57 - 48 = 9 (as an integer).
man you are so great you teached me alot of things really thx very much