Hello,I'm trying to enter a number ranged between 250 and 523 in the Serial Monitor. Then, I want the Arduino to sent back the same number (as a confirmation). The only problem is that it see each numbers as separated entries.

So if I write down: 255 I will get three Serial Print saying : Unknown Entry. ( "2" "5" and "5")

Can you point me in the correct direction?I have read from the documentation that the last character to be printed is transmitted over the serial port after Serial.print() has returned, but that didn't help

Very easy to explain. The program does what you told it to do, not what you imagined it will do. If you you align your wishes with your commands, your commands will make your wishes true. No more to say about that.

In the first two lines you say: If there's data to read, read one character. It will then check if that character is lower than 250 and at the same time higher than 253. As this is a rather unlikely proposition, your program will tell you to get stuffed.

Now assume you fix your compares so that it checks for between 250 (character ü) and 253 (character ý), it still won't like your input. Why? Because you type a "2" (ascii 50) then a "5" (ascii 53) and then a "3" (ascii 51). All three characters aren't in the range 250-253.

Either you change the data you send to you program or you change your program to read an ascii string by collecting all characters to the end of the message, then convert the string to a number (for example with atoi) before doing your test.

This small exercise could come straight out of a textbook about programming. You'd probably find it as "My third program - handling input". I leave it to you to solve that, it's very educative.

The variable v is declared as an int, so it is perfectly capable of holding 475. But, you say that you want v printed as a byte (i.e. not converted to an ascii string representing the value). But, v is not a byte sized variable. You might want to experiment to see what happens when you try to print a non-byte sized variable as a byte.

Sorry for the sarcasm, but sometimes it's just the small joys of life that makes one go on and reply. It's nothing personal, it was just a too nice opportunity to let pass up unused. If the stuff above wasn't detailed enough, feel free to ask again - for more abuse and solutions.

I'm a bit surprised, because if you do your processing only in the place where I put the "bla bla bla" and the ... (I went back and highlighted the spot in the sample), the code shouldn't be reached except after a non-digit character. If you put it somewhere else, it'll get executed more often.