connect arduino with unity, convert string to float

Hi, this code converts string values to float but I can not take advantage of converted values. For example, if you say :
if(floatFromPC1>1){
digitalWrite(1,HIGH);
}
Does not respond, What is the problem with your Opinion

this code :

#include <Stepper.h>
const byte numChars = 32;
char receivedChars[numChars];
char tempChars[numChars]; // temporary array for use when parsing
/int c=1 ;
// variables to hold the parsed data
float floatFromPC1 = 0.0;
float floatFromPC2 = 0.0;
//float m = 0.0;
//float x=1;
////float y=5 ;
// initialize the stepper library on pins 8 through 11:
//Stepper myStepper(y, 8, 9, 10, 11);
//myStepper.step(10);
boolean newData = false;

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

void setup()
{ Serial.begin(9600);
Serial.println(“This demo expects 2 pieces of data - two floating point values”);
Serial.println("Enter data in this style <65.45, 24.7> ");
Serial.println();
// myStepper.setSpeed(1023);
//myStepper.step(2048);
}

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

void loop() {
recvWithStartEndMarkers();

if (newData == true) {

strcpy(tempChars, receivedChars);
// this temporary copy is necessary to protect the original data
// because strtok() used in parseData() replaces the commas with \0
parseData();
// x=floatFromPC1-x;
//y=((5*x)/.5);
//myStepper.step(y);}

showParsedData();
newData = false;
}
}

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

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

while (Serial.available() > 0 && newData == false) {
rc = Serial.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, “,”); // this continues where the previous call left off
floatFromPC1 = atof(strtokIndx); // convert this part to a float
strtokIndx = strtok(NULL, “,”);
floatFromPC2 = atof(strtokIndx); // convert this part to a float
strtokIndx = 0;
}

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

void showParsedData() {

Serial.print(" X coord is: “);
Serial.println(floatFromPC1);
Serial.print(” Z coord is: ");
Serial.println(floatFromPC2);

}

To make it easy for people to help you please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum

Your code is too long for me to study quickly without copying to a text editor.

Also use the AutoFormat tool to indent your code for easier reading.

…R