Urgent, Please help fix compiling code error

Hi first time poster, I am having a problem with a bit of code I am using for an android controlled tank. Everytime I go to compile and upload to the arduino itself I get an error saying "stray '' in program" however I cannot seem to find what the issue is, any help would be much appreciated. Thanks in advance.

The code is as follows:

Char dataIn = ‘S’; //CharacterData coming from the phone.
int pinLeftTrackFB = 13; //Pin controls left track bank forward and backward.
Int pinRightTrackFB = 14; //Pin controls right track bank forward and backward.
int BrakeLeftTrackFB = 8; //Pin that enables/disables the left track bank.
Int BrakeRightTrackFB = 15; //Pin that enables/disables the right track bank
int pinLeftRightSpeed = 3; //Pin that sets the speed for the Left-Right motor.
int pinLeftTrackSpeed = 11; //Pin that sets the speed for the Left track bank.
Int pinRightTrackSpeed = 16; //Pin that sets the speed for the left track bank.
int pincamerapower = 4; //Pin that activates power to front camera.
int pinlights = 7; //Pin turns on led’s around tank.
char determinant; //Used in the check function, stores the character received from the phone.
char det; //Used in the loop function, stores the character received from the phone.
int velocity = 0; //Stores the speed based on the character sent by phone.

void setup()
{
// NOTE: Once Bluetooth module is received find the Bluetooth unit number and put it in brackets of serial begin.
Serial.begin(); //Initialize serial communication with Bluetooth module at underlined number btu.
pinMode(pinLeftTrackFB, OUTPUT);
pinMode(pinRightTrackFB, OUTPUT);
pinMode(pinBrakeLeftTrackFB, OUPUT);
pinMode(pinBrakeRightTrackFB, OUTPUT);
pinMode(pinLeftRightSpeed, OUTPUT);
pinMode(pinLeftTrackSpeed, OUTPUT);
pinMode(pinRightTrackSpeed, OUTPUT);
pinMode(pincamerapower, OUTPUT);
pinMode(pinlights, OUTPUT);
}

void loop()
{
det = check();
while (det == ‘F’) //If incoming data is an F, denotes the function move forward
{
digitalWrite(pinLeftTrackFB, LOW);
digitalWrite(pinRightTrackFB, LOW);
digitalWrite(pinBrakeLeftTrackFB, LOW);
digitalWrite(pinBrakeRightTrackFB, LOW);
analogWrite(pinLeftTrackFB, velocity);
analogWrite(pinRightTrackFB, velocity);
analogWrite(pinLeftTrackSpeed,255);
analogWrite(pinRightTrackSpeed,255);
det = check();
}
while (det == 'B') //if incoming data is a B, move back
{
digitalWrite(pinLeftTrackFB, HIGH);
digitalWrite(pinRightTrackFB, HIGH);
digitalWrite(pinBrakeLeftTrackFB, LOW);
digitalWrite(pinBrakeRightTrackFB, LOW);
analogWrite(pinLeftTrackFB, velocity);
analogWrite(pinRightTrackFB, velocity);
analogWrite(pinLeftTrackSpeed,-255)
analogWrite(pinRightTrackSpeed,-255)
det = check();
}

while (det == 'L') //if incoming data is a L, move wheels left
{
digitalWrite(pinLeftTrackFB, LOW);
digitalWrite(pinRightTrackFB, HIGH);
digitalWrite(pinBrakeLeftTrackFB, LOW);
digitalWrite(pinBrakeRightTrackFB, LOW);
analogWrite(pinLeftTrackFB, velocity);
analogWrite(pinRightTrackFB, velocity);
analogWrite(pinLeftTrackSpeed,0);
analogWrite(pinRightTrackSpeed,255);
det = check();
}
while (det == 'R') //if incoming data is a R, move tank right
{
digitalWrite(pinBrakeLeftTrackFB,HIGH);
digitalWrite(pinBrakeRightTrackFB,LOW);
analogWrite(pinLeftTrackFB, velocity);
analogWrite(pinRightTrackFB, velocity);
analogWrite(pinLeftTrackSpeed,255);
analogWrite(pinRightTrackSpeed,0);
det=check();
}
While (det== ‘S’) //if incoming data is a S, stop
{
digitalWrite(pinLeftTrackFB, LOW);
digitalWrite(pinRightTrackFB, LOW);
analogWrite(pinLeftTrackSpeed,0);
analogWrite(pinRightTrackSpeed,0);
det = check();
}

int check()
{
if (Serial.available() > 0) //Check for data on the serial lines.
{
dataIn = Serial.read(); //Get the character sent by the phone and store it in 'dataIn'.
if (dataIn == 'F')
{
determinant = 'F';
}
else if (dataIn == 'B')
{
determinant = 'B';
}
else if (dataIn == 'L')
{
determinant = 'L';
}
else if (dataIn == 'R')
{
determinant = 'R';
}
else if (dataIn == 'I')
{
determinant = 'I';
}
else if (dataIn == 'J')
{
determinant = 'J';
}
else if (dataIn == 'G')
{
determinant = 'G';
}
else if (dataIn == 'H')
{
determinant = 'H';
}
else if (dataIn == 'S')
{
determinant = 'S';
}
else if (dataIn == '0')
{
velocity = 0; //"velocity" does not need to be returned.
}
else if (dataIn == '1')
{
velocity = 25;
}
else if (dataIn == '2')
{
velocity = 50;
}
else if (dataIn == '3')
{
velocity = 75;
}
else if (dataIn == '4')
{
velocity = 100;
}
else if (dataIn == '5')
{
velocity = 125;
}
else if (dataIn == '6')
{
velocity = 150;
}
else if (dataIn == '7')
{
velocity = 175;
}
else if (dataIn == '8')
{
velocity = 200;
}
else if (dataIn == '9')
{
velocity = 225;
}
else if (dataIn == 'q')
{
velocity = 255;
}
else if (dataIn == 'U')
{
determinant = 'U';
}
else if (dataIn == 'u')
{
determinant = 'u';
}
else if (dataIn == 'W')
{
determinant = 'W';
}

else if (dataIn == 'w')
{
determinant = 'w';
}
}
return determinant;
}

C++ is case sensitive...

Char dataIn = ‘S’;       //CharacterData coming from the phone.
int pinLeftTrackFB = 13;    //Pin controls left track bank forward and backward.
Int pinRightTrackFB = 14;   //Pin controls right track bank forward and backward.
int BrakeLeftTrackFB = 8;   //Pin that enables/disables the left track bank.
Int BrakeRightTrackFB = 15;  //Pin that enables/disables the right track bank
int pinLeftRightSpeed = 3;   //Pin that sets the speed for the Left-Right motor.
int pinLeftTrackSpeed = 11;   //Pin that sets the speed for the Left track bank.
Int pinRightTrackSpeed = 16;  //Pin that sets the speed for the left track bank.
int pincamerapower = 4;    //Pin that activates power to front camera.
int pinlights = 7;   //Pin turns on led’s around tank.
char determinant;    //Used in the check function, stores the character received from the phone.
char det;    //Used in the loop function, stores the character received from the phone.
int velocity = 0;    //Stores the speed based on the character sent by phone.

int, or Int?

char or Char?

its fussy like that...

Hi, thanks for the feedback, yeah I noticed it just after I posted it, also my 'S' was a bit dodgy, still needs a bit of work as I am new to programming so any advice on the code would be much appreciated :slight_smile:

Ok so I have gone through more of the code and if anyone is interested or has the same issue here is what I did to fix the issue, if you have written the code in something like msWord check all of your apostrophes as italicized ones will show an error also make sure the code is in lower case when it is meant to and upper case when it is meant to, other than that I think I've solved my issue.

Thanks and hope my mistakes will help someone else

my advice is to pay attention to syntax, spelling, caps, etc., and listen to your compiler's error report.

also, don't use MS word as an editor for your code. Stick with the IDE's editor, much better for writing code... It will help you see your errors.

Also, use the hashtag above the dialog box to put your code between Code Tags:

my code

Hey thanks for the advice, yeah my main issue here was syntax and cool as I am new here I didn't know thats how you put code in a separate box thingy

Now I know hehehe thanks :D

Try this:

int check()
{
  if (Serial.available() > 0)    //Check for data on the serial lines.
  {   
    dataIn = Serial.read();  //Get the character sent by the phone and store it in 'dataIn'.

        if ((dataIn >47) && (dataIn <58)){ //is it a number? See ASCII codes.
              velocity = (dataIn -48) *25;  //if so, set velocity.
             }
         else{  //not a number
              return dataIn;
             }  
   }
}
if ((dataIn >= '0') && (dataIn <= '9')){ //is it a number?
              velocity = (dataIn - '0') *25;