void setup(){ Serial.begin(9600);}void loop(){ while (Serial.available() == 0); int val = Serial.read() - '0'; Serial.flush(); Serial.println(val); }
thanks it make sense can you tell me how to resolve the new line?
I hope you aren't going to want to send more than "9" to the serial port, or you may have to rethink your approach. And you may have to read this:http://www.gammon.com.au/serial