Is this close?
That snippet looks better, but I still don't think that it is right. I think that you want to get xAxis AND yAxis, and compare them to xAxis1 and yAxis1. If either value is different, use both values.
I could be wrong, though.
Is this close?
That snippet looks better, but I still don't think that it is right. I think that you want to get xAxis AND yAxis, and compare them to xAxis1 and yAxis1. If either value is different, use both values.
I could be wrong, though.
Is this how you would do it? (or close)
void processAndroidData() { // split the data into its parts
xAxis1 = xAxis; //variable to compare data from last loop
yAxis1 = yAxis; //variable to compare data from last loop
char * strtokIndx; // this is used by strtok() as an index
strtokIndx = strtok(tempChars, ",");
xAxis = atoi(strtokIndx); // convert this part to an integer
strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
yAxis = atoi(strtokIndx); // convert this part to an integer
if ((yAxis == yAxis1) || (xAxis == xAxis1)){ //if variables match, then Android is "frozen" - stop motors
allStop();
}
}
Is this how you would do it? (or close)
Yes.
It works just like I was intending. Thanks for your help. I appreciate it.