I am totally new to this coding stuff, so i was hoping you guys would help me?
I want to change the angle of my servo through serial monitor, but no matter what i type it keeps resetting to 10 for some reason.
10 is the ASCII code for new line.
Change the line ending control on the serial monitor to "none".
Better still, find out how to parse a multi digit number, so you don't have to translate positions to ASCII codes.
Please get into the habit of using code tags when posting code.
Damn. i wish i understood this... but i kind of dont. in the tutorial, i sort of understood that char converts ascii to normal numbers, but it only goes up to 137? is that right? cause i need 180 for this one. Is it array or string i need to look into?
I don't know where 137 comes from, but once you've subtracted the ASCII value for the character '0' from each digit, the rest is simply decimal arithmetic.
MalharD:
replace Serial.read() with Serial.parseInt() as the forum(And Robin2) suggested me.
Just to be perefctly clear I have NOT recommended the use of Serial.parseInt(). The whole point of the examples in Serial Input Basics is that they are non-blocking.