66: error: a function-definition is not allowed here before '{' token

Hi I’m a newbie to robot and programing. I need some help to understand what is wrong with my car program. I copy the program out of a book for my first jump into understanding how thing work.

The error message I am getting is " error: a function-definition is not allowed here before ‘{’ token"

The full statement is:

void back() //move backward
{
digitalWrite(pinLB,HIGH); //motor moves to left rear
digitalWrite(pinRB, HIGH); //motor moves to right rear
analogWrite(pinLF,0);
analogWrite(pinRF,0);
}

I have attach the full program.
I have tested each part of my car by its self and they all work but when I put stuff together I can not get the code to work.

Any help is much appreciated thanks
Tink

error test.txt (7.27 KB)

The first (logic) mistake that I see adter pasting the code in the IDE is the semicolon at the end of most of those if statements. As a result, the block between { and } will always be executed regardless of the value of directionn.

     if(directionn==6);        //if directionn=6
      {
...
...
      }
    if(directionn==4);        //if directionn=4
       {
....
...       
    }

This however does not cause the error; you're missing a } at the end of stopp().

Use menu tools->auto format in the IDE to properly indent and the cause of the error becomes apparent.

void advance)      //move forward
{
  digitalWrite(pinLB, LOW); //right wheel moves forward
  analogWrite(pinRB, LOW);    //left wheel oves forward
  analogWrite(pinLF, 255);
  analogWrite(pinRF, 255);
}
void stopp()      //stop
{
  digitalWrite(pinLB, HIGH);
  digitalWrite(pinRB, HIGH);
  analogWrite(pinLF, 0);
  analogWrite(pinRF, 0);

  void right()      //turn right (single wheel)
  {
...
...

After using the auto format, function definitions should ALWAYS start at the beginning of a line.

PS1: The advance above is missing a ( as well. PS2: back is not the same as Back; C is case sensitive