I used multiple of Serial.read() and Serial.parseInt() to get characters and a number ( like "xy123" ) on an Arduino UNO. Then I checked the result on Serial monitor.
Unfortunately I couldn't get the character with second Serial.read().
Here's the code:
void setup(){
Serial.begin(9600);
}
void loop(){
if (Serial.available() >0) {
// I want to reacive the characters like "xy123"
char input1 = Serial.read();
char input2 = Serial.read();
int value = Serial.parseInt();
Serial.println(input1); // ok
Serial.println(input2); // * no good * (-1)
Serial.println(value); // ok
// Writing some codes with input1 ,input2 and value ...
}
// I don't want to use delay().
}
How do I get the second character?
Thanks.