Sending values seperated by comma over xbee

am failing to get the correct output. I am reading in either a value like or <S444,555>. I am trying to concentrate on getting the code correct to split up the <444,555> into two values to use. Depending on which it is, in the started && ended, it will either be <S444,555> or a which is a ‘B’ or ‘G’ and store the integers to use.

Your code is basically based around the serial data arriving in one chunk. Please read this:

Yes, I understand your last topic on receiving the data…I had that correct when I was originally implementing the standard numbers. When I changed my code a little to find two values like <S444,555> with the comma is why I am getting problems.

I will look at your code and try to implement mine.

Very simple code that uses a , as a delimiter.

//zoomkat 3-5-12 simple delimited ',' string parce 
//from serial port input (via serial monitor)
//and print result out serial port
// CR/LF could also be a delimiter

String readString;

void setup() {
  Serial.begin(9600);
  Serial.println("serial delimit test 1.0"); // so I can keep track of what is loaded
}

void loop() {

  //expect a string like wer,qwe rty,123 456,hyre kjhg,
  //or like hello world,who are you?,bye!,
  
  if (Serial.available())  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == ',') {
      //do stuff
      Serial.println(readString); //prints string to serial port out
      readString=""; //clears variable for new input      
     }  
    else {     
      readString += c; //makes the string readString
    }
  }
}
  while(Serial.available() > 0)
  {
...
      while(Serial.available() > 0)

I just don’t like two while available (nested) like that. I suggest you redesign.

As in possible use if(Serial.available() > 0) and can have a while statement within like I have?

My output looks reasonable except it want jump into the last if statement.

Don't overcomplicate it. The post I linked suggests a state machine. That should do it.

  double steeringInput = constrain(value, 400, 1023); //345 and 795 were min and max of steering wheel pot
  double wheelInput = constrain(value, 150, 480); //150 and 480 were min and max of wheel position pot
  double currentPos = map(wheelInput, 150, 480, -100,100);

The inputs and limits and ranges are ints. You store the output, which is an int, in doubles. Why?

Not sure, I can change that. I have not tested this code yet as I have a question related to it mentioned above with the subroutines. I am fixing the double's.