I am very new to Arduino Programming. I am trying to identify the input string from serial monitor and printing the output to the console accordingly
Code is :
void setup() {
Serial.begin(9600);
}
void loop() {
while (Serial.available() > 0 ) {
String str = Serial.readString();
if (str.equals("send")) {
Serial.println("identified");
} else {
Serial.println("unknown");
}
}
}
Whenever i put send string it is showing "unknown" as the output, which is wrong, and i should get "identified" as the output. Can anyone guide me here to achieve the result.
Note : I am getting output as i wanted by using readStringUntil function but the strings has a lot of "." in it, hence not useful.
\r\n
not/r/n
... – Majenko♦ Jan 1 '18 at 18:08