Reading Double Digits

Hello Group!

Ok I've read alot on the forums and surfing the web to answer this question. How to I use double digits or even double letters from the serial monitor? For example a piece of code below:

if(input == "10"){
digitalWrite(10, HIGH);
Serial.println("ON");
}

if(input == "11"){
digitalWrite(10, LOW);
Serial.println("OFF");
}

Single quotes are used for single ints/chars and double quotes used for double ints/chars. How ever the serial monitor is only reading 1 byte at a time. How do I resolve this? Thanks!

How do I resolve this?

The same way you put your shoes on. Put one on. Put the other one on. Not f**king rocket science.

Read the first byte. Read the second byte. Engage your brain to figure out how to make "12" from '1' and '2'.

The serial input basics tutorial might help you.

@groundFungus:

It did thanks...working code below:

while (Serial.available()) {
char c = Serial.read();      
readString += c;             
delay(2);                    
}

if (readString.length() >0) {
Serial.println(readString); 
int n = readString.toInt();

It did thanks...working code below:

Now, re-read the thread, put the crutches away, and do it without using the String class. It's just as easy to not piss away resources uselessly.

PaulS:
Now, re-read the thread, put the crutches away, and do it without using the String class. It's just as easy to not piss away resources uselessly.

It would help if we had a link to the "how not to piss away resources uselessly" tutorial.

odometer:
It would help if we had a link to the "how not to piss away resources uselessly" tutorial.

Isn't that link in reply #2?