Error in Code - Missing Parentheses?? WHERE?

Hi all,

Arduino IDE is giving me the following error message when I attempt to compile my code:

sketch_jun23b.cpp:33:1: error: expected ')' before '}' token
sketch_jun23b.cpp:33:1: error: expected primary-expression before '}' token
sketch_jun23b.cpp:33:1: error: expected ';' before '}' token

I'm fairly new to arduino. I interpret this as saying that I'm missing a parentheses and semicolon at line 33? Trouble is, I'm can't seem to find the missing parentheses...

int carRed = 12; // assign the car lights
int carYellow = 11;
int carGreen = 10;
int pedRed = 9; // assign the pedestrian lights
int pedGreen = 8;
int button = 2; // button pin
int crossTime = 5000; //time allowed to cross
unsigned long changeTime; //time since button pressed

void setup () {
pinMode(carRed, OUTPUT);
pinMode(carYellow, OUTPUT);
pinMode(carGreen, OUTPUT);
pinMode(pedRed, OUTPUT);
pinMode(pedGreen, OUTPUT);
pinMode(button, INPUT); // button on pin 2
// turn on the green light
digitalWrite(carGreen, HIGH);
digitalWrite(pedRed, HIGH);
}

void loop() {
int state = digitalRead(button);
/* check if button is pressed and that it has been over 5 seconds since the last button press*/
if (state == HIGH && ((millis() - change Time) > 5000)) {
//Call the function to change the lights
changeLights();
}
}

void changeLights() {
digitalWrite(carGreen, LOW); // green off
digitalWrite(carYellow, HIGH); // yellow on
delay(2000); // wait 2 seconds

digitalWrite(carYellow, LOW); //yellow off
digitalWrite(carRed, HIGH); // red on
delay(1000); //wait 1 second till it's safe to cross the road

digitalWrite(pedRed, LOW); //ped red off
digitalWrite(pedGreen, HIGH); //ped green on
delay(crossTime); // wait for preset time period

// flash for the pedGreen
for (int x = 0; x <10; x++) {
digitalWrite(pedGreen, HIGH);
delay(250);
digitalWrite(pedGreen, LOW);
delay(250);
}

//turn pedRed on
digitalWrite(pedRed, HIGH);
delay(500);

digitalWrite(carRed, LOW); // red off
delay(100); // wait just a tiny bit

digitalWrite(carGreen, HIGH); // green on

//record the time since last change of lights
changeTime = millis();
// then return to the main program loop
}

No the actual error is that "change" wasn't declared in scope. You have a variable declared as "changeTime" at the top, but then add a space in "change Time" so it moans. Take the space out, it compiles.

In the code I uploaded it looks like both instances of "changeTime" don't have a space? or am I misreading it?

There's a space here, I put in an X so you can see where I mean:

 if (state == HIGH && ((millis() - changeXTime) > 5000)) {

WHERE ??

In or near line 33

The messages about the missing parens are probably a consequence of "change" not being declared. The actual error highlighted on the IDE main panel (not in the box at the bottom) that I got was "change was not declared in this scope" and the highlighted line of code is:

if (state == HIGH && ((millis() - change Time) > 5000)) {

The space between "change" and "Time" is clearly visible, and when i took the space out, it compiled cleanly.

Binary sketch size: 1,614 bytes (of a 32,256 byte maximum)