HELP!! need to talk to PC!

I have worked out the routines but there is still a problem.

The Arduino code I have will receive the commands but the Arduino code I have will not 'sort' the commends.

I my snippet of code i try to 'reconize' the 'abc' and send a response back, but it doesn't work!

Any help?

Thanks

//serial routine ***************************************************
  if (byteComplete) {
    //Serial.print(rcvByte);
    if (rcvByte="abc") {
      Serial.print("error");
    }
    rcvByte = "";
    byteComplete = false;
  }
}
void serialEvent() {
  while (Serial.available()) {
    char inChar = (char)Serial.read();
    rcvByte += inChar;
    if (inChar == '\n') {
      byteComplete = true;
    }
  }

}

"abc" is not the same as "abc\n"

Why do you call a variable that contains a String somethingByte?

Please forget that Sting (capital S) exists in the Arduino world; memory fragmentation can be a result.

Read Serial Input Basics for approaches without te use of String.

if (rcvByte="abc")

Nothing about this line of code is right:

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()

3.) You CAN NOT do "if(String == "something")". If you must compare one string to another, use String.equals()

If one of the operands is a String, then the String class's == operator is used and you CAN compare a String to a string that way.

OK, Thanks to all those that responded.

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(receivedChars=="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.

        Serial.print("This just in ... ");
        Serial.println(receivedChars);

With this code, you can't tell whether receivedChars contains any non-printing characters, such as line feeds or carriage returns.

        Serial.print("This just in ... [");
        Serial.print(receivedChars);
        Serial.println("]");

clearly shows whether receivedChars contains any non-printing characters.

Parsing unknown data is not easy. Making the data KNOWN is not that hard.

YEA!!!
The strcmp command worked!!!

Thanks again to all who responded!