1.) rcvByte is not a byte, but a String. Please name your variables accurately
2.) You need to use "==", not "=", when doing an "equals to" comparison in an if statement
3.) You CAN NOT do "if(String == "something")". If you must compare one string to another, use String.equals()
But here is a different situation.
I read sterretje's example and downloaded the code and it works fine.
The trouble I am having is when I add in the code
void showNewData() {
if (newData == true) {
Serial.print("This just in ... ");
Serial.println(receivedChars);
if(receivedChars=="Option10") { //code added
Serial.println("opt 10"); //code added
} //code added
newData = false;
}
}
it doesn't recognize the 'Option10' input and respond with the 'opt 10' , it just outputs the 'Option10'?
If you are using the code from Robin2's serial input basics tutorial, the data type of receivedChars is string (null terminated character array) not String (object). To compare strings use the strcmp() function from the string,h library (the string.h library is automatically included in an Arduino sketch).
You should post the whole program. Snippets often always leave out important information.