comparing received data over xbee

im having trouble comparing im using strtok and sending it with start and endmarkers. my servo angles are writing just fine but i cant seem to send "connected" and compare it properly

// Receive with start- and end-markers combined with parsing
#include <Servo.h>
#include <SoftwareSerial.h>
SoftwareSerial xbee(10, 11); // TX, RX
Servo SteerServo, MotorServo, CamServoC, CamServoD;

const byte numChars = 32;
char receivedChars[numChars];
char tempChars[numChars];
char messageFromTX[numChars] = {0};

int ServoA = 0;
int ServoB = 0;
int ServoC = 0;
int ServoD = 0;

boolean newData = false;
boolean Connection = false;
//============
void setup() {

  Serial.begin(9600);
  xbee.begin(9600);
  CamServoC.attach(5); n/..
  SteerServo.attach(6);
  MotorServo.attach(7);
  lcd.begin (16, 2);
  lcd.clear();
  //Enter data in this style <text,12,24.7>
}

//============

void loop() {
 
  recvWithStartEndMarkers();
  if (newData == true) {
    strcpy(tempChars, receivedChars);
    // this temporary copy is necessary to protect the original data
    //   because strtok() replaces the commas with \0
    parseData();
    delay(10);
    showParsedData();
    movement();
    newData = false;
      if(messageFromTX == "connected"){
    Connection = true;
    Serial.println("connected");
  }
  }
}

//============

void recvWithStartEndMarkers() {
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '<';
  char endMarker = '>';
  char rc;

  while (xbee.available() > 0 && newData == false) {
    rc = xbee.read();
    if (recvInProgress == true) {
      if (rc != endMarker) {
        receivedChars[ndx] = rc;
        ndx++;
        if (ndx >= numChars) {
          ndx = numChars - 1;
        }
      }
      else {
        receivedChars[ndx] = '\0'; // terminate the string
        recvInProgress = false;
        ndx = 0;
        newData = true;
      }
    }

    else if (rc == startMarker) {
      recvInProgress = true;
    }
  }
}

//============

void parseData() {

  // split the data into its parts
  char * strtokIndx; // this is used by strtok() as an index

  strtokIndx = strtok(tempChars, ",");     // get the first part - the string
  strcpy(messageFromTX, strtokIndx); // copy it to messageFromPC

  strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
  ServoA = atoi(strtokIndx);     // convert this part to an integer

  strtokIndx = strtok(NULL, ",");
  ServoB = atoi(strtokIndx);     // convert this part to a float

  strtokIndx = strtok(NULL, ",");
  ServoC = atoi(strtokIndx);

  strtokIndx = strtok(NULL, ",");
  ServoD = atoi(strtokIndx);
}

//============

void showParsedData() {
  Serial.print(ServoA);
  Serial.print(", ");
  Serial.print(ServoB);
  Serial.print(", ");
  Serial.print(ServoC);
  Serial.print(", ");
  Serial.println(ServoD);
}
void movement() {
  MotorServo.write(ServoA);
  SteerServo.write(ServoB);
}
void CamMovement() {
  CamServoC.write(ServoC);

}

Not really sure how your code is supposed to work, but below is a fairly simple way to receive multiple servo commands that have the servo position value, a servo identifier, and a comma , end of packet identifier.

//zoomkat 11-22-12 simple delimited ',' string parse 
//from serial port input (via serial monitor)
//and print result out serial port
//multi servos added 
// Powering a servo from the arduino usually *DOES NOT WORK*.

String readString;
#include <Servo.h> 
Servo myservoa, myservob, myservoc, myservod;  // create servo object to control a servo 

void setup() {
  Serial.begin(9600);

  //myservoa.writeMicroseconds(1500); //set initial servo position if desired

  myservoa.attach(6);  //the pin for the servoa control
  myservob.attach(7);  //the pin for the servob control
  myservoc.attach(8);  //the pin for the servoc control
  myservod.attach(9);  //the pin for the servod control 
  Serial.println("multi-servo-delimit-test-dual-input-11-22-12"); // so I can keep track of what is loaded
}

void loop() {

  //expect single strings like 700a, or 1500c, or 2000d,
  //or like 30c, or 90a, or 180d,
  //or combined like 30c,180b,70a,120d,

  if (Serial.available())  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == ',') {
      if (readString.length() >1) {
        Serial.println(readString); //prints string to serial port out

        int n = readString.toInt();  //convert readString into a number

        // auto select appropriate value, copied from someone elses code.
        if(n >= 500)
        {
          Serial.print("writing Microseconds: ");
          Serial.println(n);
          if(readString.indexOf('a') >0) myservoa.writeMicroseconds(n);
          if(readString.indexOf('b') >0) myservob.writeMicroseconds(n);
          if(readString.indexOf('c') >0) myservoc.writeMicroseconds(n);
          if(readString.indexOf('d') >0) myservod.writeMicroseconds(n);
        }
        else
        {   
          Serial.print("writing Angle: ");
          Serial.println(n);
          if(readString.indexOf('a') >0) myservoa.write(n);
          if(readString.indexOf('b') >0) myservob.write(n);
          if(readString.indexOf('c') >0) myservoc.write(n);
          if(readString.indexOf('d') >0) myservod.write(n);
        }
         readString=""; //clears variable for new input
      }
    }  
    else {     
      readString += c; //makes the string readString
    }
  }
}

The servo values work perfect it's comparing actual words like "connected" and having it do stuff with that. I was told that strtok was better to use by pauls and robin

I was told that strtok was better to use by pauls and robin

So, why aren't you using char arrays?

Where ARE you trying to compare readString to "connected"?

Wouldn't it be stored in message from pc

and if so wouldnt this work

  if(messageFromTX == "connected"){
    Connection = true;
    Serial.println("connected");
  }

or do i still have do something with messagefromtx because its already saved in a char

Wouldn't it be stored in message from pc

Wouldn't what be stored in what?

and if so wouldnt this work

It should, IF that snippet of code is in the right place and IF there were a variable called messageFromTX that contained what its name inplies.

or do i still have do something with messagefromtx because its already saved in a char

You don't have a variable called messagefromtx, so asking questions about a non-existent variable does not make sense.

so if im sending <connection,> through xbee to the recieveing xbee i would need something like this where Checkconnect would replace messagefromx

Checkconnect = strtok(tempChars, ",");

[/c#include <SoftwareSerial.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

SoftwareSerial xbee(8, 7);
const byte numChars = 32;
char receivedChars[numChars];
char tempChars[numChars];        // temporary array for use by strtok() functio
char* Checkconnect;
char messageFromTX[numChars] = {0};
int integerFromPC = 0;
float floatFromPC = 0.0;
boolean Connection = false;
boolean newData = false;

void setup()  {

  Serial.begin(9600);
  // set the data rate for the SoftwareSerial port
  xbee.begin(9600);
  lcd.begin (16, 2);
  lcd.clear();
}



void loop()                     // run over and over again
{
  recvWithStartEndMarkers();
  if (newData == true) {
    strcpy(tempChars, receivedChars);
    // this temporary copy is necessary to protect the original data
    //   because strtok() replaces the commas with \0
    parseData();
    showParsedData();
    newData = false;
  }
}

void recvWithStartEndMarkers() {
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '<';
  char endMarker = '>';
  char rc;

  while (xbee.available() > 0 && newData == false) {
    rc = xbee.read();
    Serial.print(rc);

    if (recvInProgress == true) {
      if (rc != endMarker) {
        receivedChars[ndx] = rc;
        ndx++;
        if (ndx >= numChars) {
          ndx = numChars - 1;
        }
      }
      else {
        receivedChars[ndx] = '\0'; // terminate the string
        recvInProgress = false;
        ndx = 0;
        newData = true;
      }
    }

    else if (rc == startMarker) {
      recvInProgress = true;
    }
  }
}

//============

void parseData() {

  // split the data into its parts
  char * strtokIndx; // this is used by strtok() as an index

  strtokIndx = strtok(tempChars, ",");     // get the first part - the string
  strcpy(messageFromTX, strtokIndx); // copy it to messageFromPC

  strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
  integerFromPC = atoi(strtokIndx);     // convert this part to an integer

  strtokIndx = strtok(NULL, ",");
  floatFromPC = atof(strtokIndx);     // convert this part to a float

  Checkconnect = strtok(tempChars, ",");
}

//============

void showParsedData() {
  Serial.print("Message ");
  Serial.println(messageFromTX);
  Serial.print("Integer ");
  Serial.println(integerFromPC);
  Serial.print("Float ");
  Serial.println(floatFromPC);
  if (Checkconnect == "connected") {
    Connection = true;
  }
  delay(500);
  if (Connection == true) {
    lcd.clear();
    lcd.setBacklight(HIGH);
    lcd.setCursor(0, 0);
    lcd.print("Fido!");
    lcd.setCursor(0, 1);
    lcd.print("Activated!");
    delay(2000);
  }
  else if (Connection == false) {
    lcd.clear();
    lcd.setBacklight(HIGH);
    lcd.setCursor(0, 0);
    lcd.print("Activating Fido!");
    lcd.setCursor(0, 1);
    lcd.print("****************");
  }
}ode]