Writes binary data to the serial port. This data is sent as a byte or series of bytes; to send the characters representing the digits of a number use the print() function instead.
In summary, use print() and println() instead of write if you want the characters as opposed to the integer values.
thats the thing
actually the code posted above did work for me I think
when I wrote '1' it printed '1' and so on.
what I ment is that it stores the values wrong
e.g.
when I use this code
It's a matter of ASCII versus decimal values and confusing characters and numbers.
If you look at the following ASCII chart: http://www.asciitable.com/
And find the character 5, you'll see that it's decimal value is 53.
If you look up the decimal value 5, you'll see that this is the non-printable control character ENQ.
So, if you want to check for the character 5, use single quotes to indicate that it is a character.
if(input == '5')
When you use (input == 5), you are comparing the decimal value of the character received, not the character itself.