Error while compliling

Hi there I'm pretty new to Arduino, and overall everything worked but now I keep getting this:

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.6 (Windows NT (unknown)), Board: "Arduino Uno"
sketch_jun28a:110: error: expected unqualified-id before '{' token

Thats my code

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
#include <Servo.h> 
 
Servo myservo;
const int 
PWM_A   = 3,
DIR_A   = 12,
BRAKE_A = 9,
SNS_A   = A0;
boolean isRed;
boolean isOK;
boolean redWanted;
boolean whiteWanted;
int pos = 0;
int led = 12;
int digitalPin1 = 10;
int digitalPin2 = 11;
int analogPin3 = A3;
int analogPin4 = A4;
int test = 0;

// the setup routine runs once when you press reset:
void setup()
{
  // Configure the A output
  pinMode(BRAKE_A, OUTPUT);  // Brake pin on channel A
  pinMode(DIR_A, OUTPUT);    // Direction pin on channel A
  pinMode(digitalPin1, INPUT);
  pinMode(digitalPin2, INPUT);
  pinMode(analogPin3, INPUT);

  // Open Serial communication

  // initialize the digital pin as an output.
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
  Serial.begin(9600);          //  setup serial
  pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop()
{
digitalWrite(led, LOW);   // turn the LED on (HIGH is the voltage level)
  delay(100);               // wait for a second
 
  analogWrite(PWM_A, 45);     // Set the speed of the motor
  //while(1);

	//Value on pin 1: 1 ==> bear is red
	//				  0 ==> bear is not red
	//Value on pin 2: 1 ==> bear is ok
	//				  0 ==> bear is not ok

	isRed = false;
	isOK = false;
	redWanted = false;
	whiteWanted = false;

	if (digitalRead(digitalPin1) == HIGH) 

{
  isRed = true;
  Serial.println("Is Red");
}
else
{
  isRed = false;
  Serial.println("Is not Red");
}
	if (digitalRead(digitalPin2) == LOW)
{
  isOK = true;
  Serial.println("Is ok");
}
else 
{
  isOK = false;
  Serial.println("Is not ok");
}
	if (analogRead(analogPin3) > 800)
{
  redWanted = true;
  whiteWanted = false;
  Serial.println("Red is Wanted");
}
else 
{
  redWanted = false;
  whiteWanted = true;
  Serial.println("Is not ok");
}
  delay(2000);
	if (analogRead(analogPin3) > 800)
{  
  redWanted = true;
whiteWanted = false;
}
if (analogRead(analogPin3) < 800)
{  
whiteWanted = true; 
redWanted = false;
}
	//if (isRed = true; 
    if(isRed == true && redWanted == true && isOK == true) 
        digitalWrite(led, HIGH);    // turn the LED off by making the voltage LOW
  delay(100);               // wait for a second
}   
{	
for(pos = 0; pos>=180; pos-=1);  // goes from 0 degrees to 180 degrees 
	{                                  // in steps of 1 degree 
		myservo.write(pos);              // tell servo to go to position in variable 'pos' 
		delay(20);   
Serial.println("fahre aus");
// waits 20ms for the servo to reach the position 

else

for(pos = 0; pos>=180; pos-=1);     // goes from 180 degrees to 0 degrees 
{                                
	myservo.write(pos);              // tell servo to go to position in variable 'pos' 
	delay(20);                       // waits 20ms for the servo to reach the position 
Serial.println("fahre ein");	

}  
    }
   
       // test = digitalRead(digitalPin1);  // Input auslesen
//if (test == HIGH) {            // Wenn Input= HIGH 
//digitalWrite(led, LOW);  // dann LED aus
//}
//else {
//digitalWrite(led, HIGH); // andernfalls LED an.
//}
 // Serial.println(isRed);
  
 }

I'm happy for any help

Thanks a lot

Mena

Look in the line 110 area.

Also does this look correct ;)?
for(pos = 0; pos>=180; pos-=1) ;

Usually, putting a semicolon at the end of a for loop is really not what you want to do.

  for (pos = 0; pos >= 180; pos -= 1); // goes from 0 degrees to 180 degrees

and that's been done in several places. Also, it seems that you have your braces mismatched.

So much for trying to teach.

.

Thanks for the help, I already removed the { and the ;

I've set this because otherwise I keep getting more and more errors:

It don't understands the Sweep task anymore (Copied from here: https://www.arduino.cc/en/Tutorial/Sweep)
So I thought I might be on the right way.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.6 (Windows NT (unknown)), Board: "Arduino Uno"
sketch_jun28a:110: error: expected unqualified-id before 'for'
sketch_jun28a:110: error: expected constructor, destructor, or type conversion before '>=' token
sketch_jun28a:110: error: expected constructor, destructor, or type conversion before '-=' token

Thanks a lot

Mena

Fix this too:
const int
PWM_A = 3,
DIR_A = 12,
BRAKE_A = 9,
SNS_A = A0;

Perhaps:
const int PWM_A = 3;
const int DIR_A = 12;
const int BRAKE_A = 9;
const int SNS_A = A0;

To save memory, all could be byte instead of int also (value between 0 and 255, yes?)

Syntactically, there's nothing wrong with:

const int 
PWM_A   = 3,
DIR_A   = 12,
BRAKE_A = 9,
SNS_A   = A0;

It will compile just fine. However, what CrossRoads shows is a better form of coding the definitions.

@LarryD: Sorry 'bout that.

The initial error is probably from this:

if(isRed == true && redWanted == true && isOK == true) <<<< missing a { here
digitalWrite(led, HIGH); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
} <<<< to go with this one

LarryD:
So much for trying to teach.

.

LarryD:
So much for trying to teach.

.

I guess your perception of teaching and mine are different.
You did not teach , you just pointed out what the compiler already done.
I would call it nagging, but what do I know.

To the OP
read - up on for() command definition / format .
Initial (expression), test (expression), increment (expression) and statement - the body of the command.
The "increment" can be negative, weird but mathematically acceptable.

If you use IDE "autoFormat" tool, you can see where the extra ; should NOT be easier.
If you use "line numbers " in you post text people can find the line where the compiler got stuck easier.

And if you carefully MATCH your comments with desired action - you can see where your expressions (initial and test expressions) are codded wrong too.

for ( init-expr; test-expr; increment-expr) { statement }

Addendum
After reading Crossroads post - check your brackets pairs ( {}) ) , on "broken 1.6.5. " you can still position you mouse on starting bracket and the corresponding end bracket one should get /display a blue frame around it. This feature used to highlight the entire code block inside the brackets.

PS the composite AND statement is correct! The brackets are not.

I guess your perception of teaching and mine are different.
You did not teach , you just pointed out what the compiler already done.
I would call it nagging, but what do I know.

What, indeed, do you know, Vaclav?
The compiler did not and could not point out a semicolon at the end of a "for".

(it's only necessary to quote someone once. Don't worry, you'll get the hang of it sooner or later.)

You know what the compiler was saying but did the OP.
That's why I brought it to their attention line 110 may be an area of interest.
They may have missed this. (And they did as they could not find their error)

Also I gave a hint that the "for" function may be in question.

Deferent ways of trying to help I guess.

.