program error

Why does this code not work. It is supposed to control a traffic light

// Project 5 - Controlling Traffic
// define the pins that the buttons and lights are connected to:
#define westButton 7
#define eastButton 13
#define westRed 2
#define westYellow 1
#define westGreen 0
#define eastRed 12
#define eastYellow 11
#define eastGreen 10
#define yellowBlinkTime 100 // 0.1 seconds for yellow light blink
boolean trafficWest = true // west = true, east = false
;int flowTime = 5000; // amount of time to let traffic flow
;int changeDelay = 1000; // amount of time between color changes

void setup() {
// setup digital I/O pins
pinMode(westButton, INPUT);
pinMode(eastButton, INPUT);
pinMode(westRed, OUTPUT);
pinMode(westYellow, OUTPUT);
pinMode(westGreen, OUTPUT);
pinMode(eastRed, OUTPUT);
pinMode(eastYellow, OUTPUT);
pinMode(eastGreen, OUTPUT);

// set initial state for lights - west side is green first
digitalWrite(westRed, LOW);
digitalWrite(westYellow, LOW);
digitalWrite(westGreen, HIGH);
digitalWrite(eastRed, HIGH);
digitalWrite(eastYellow, LOW);
digitalWrite(eastGreen, LOW);

}

void loop() {
if ( digitalRead(westButton) == HIGH ) // request west>east traffic flow
{
if ( trafficWest != true )
// only continue if traffic flowing in the opposite (east) direction
{
trafficWest = true; // change traffic flow flag to west>east
delay(flowTime); // give time for traffic to flow
digitalWrite(eastGreen, LOW); // change east-facing lights from green
// to yellow to red
digitalWrite(eastYellow, HIGH);
delay(changeDelay);
digitalWrite(eastYellow, LOW);
digitalWrite(eastRed, HIGH);
delay(changeDelay);
for ( int a = 0; a < 5; a++ ) // blink yellow light
{
digitalWrite(westYellow, LOW);
delay(yellowBlinkTime);
digitalWrite(westYellow, HIGH);
delay(yellowBlinkTime);
}
digitalWrite(westYellow, LOW);
digitalWrite(westRed, LOW); // change west-facing lights from red to green
digitalWrite(westGreen, HIGH);
}
}
if ( digitalRead(eastButton) == HIGH ) // request east>west traffic flow
{
if ( trafficWest == true )
// only continue if traffic flow is in the opposite (west) direction
{
trafficWest = false; // change traffic flow flag to east>west
delay(flowTime); // give time for traffic to flow
digitalWrite(westGreen, LOW);
// change west lights from green to yellow to red
digitalWrite(westYellow, HIGH);
delay(changeDelay);
digitalWrite(westYellow, LOW);
digitalWrite(westRed, HIGH);
delay(changeDelay);
for ( int a = 0 ; a < 5 ; a++ ) // blink yellow light
{
digitalWrite(eastYellow, LOW);
delay(yellowBlinkTime);
digitalWrite(eastYellow, HIGH);
delay(yellowBlinkTime);
}
digitalWrite(eastYellow, LOW);
digitalWrite(eastRed, LOW); // change east-facing lights from red to green
digitalWrite(eastGreen, HIGH);
}
}
}

Use code tags when posting </>
What doesn't work?

You've got some funky looking usage of ; in your boolean and int declarations

Can we at least get a clue as to what is wrong?
Are there pulldown resistors on the switches?

Please read the "how to use the forum" stickies. They will tell how to format and post code properly.

here is described what it is supposed to do. The only thing that doesn't work are the buttons at the moment.

Why don't you get your program to tell you what it is doing?

we tried, but we dont understand it and it doesnt seem to work

Ok

we have connected everything like ti is supposed to and the code is changed to the placements of the parts in the breadbord

arduinokutjes:
http://pop.h-cdn.co/assets/cm/15/06/54cfd847b77c5_-_arduino_project5.pdf

here is described what it is supposed to do. The only thing that doesn't work are the buttons at the moment.

So your problem is with the wiring of the buttons. Make a drawing of it, or show us a photo with everything visible.

It appears that your switches are not wired right. In the sketch in your first post the switches are wired so that when the switch is closed (pushed) the the input sees HIGH. The way that they are wired, if the switch is open the resistor pulls the pin high (why 3.3v?). When the switch is closed the jumper (lower right of switch) pulls the input high. The cap is not doing anything. I really don't know what the orange wires are there for?

I recommend that you wire the switches as shown below, change the pinModes to INPUT_PULLUP and change your logic so that the input is LOW when the switch is pressed. Then the hardware debounce cap will work. Be aware of how those switches are inside. On each side the terminals are wired together (check with ohmmeter). If you wire to diagonal terminals the wiring will always be right.

I am kind of confused. I don't see a ground going to the breadboard. It is hard to see in the pictures where all of the wires are going. Can you draw a schematic of the project that shows the pin connections? Do you really have LEDs connected to pins 0 and 1? Those are the hardware serial pins (TX and RX) that are used to upload your code and send debugging information to serial monitor. I know that you are not using serial in the sketch, but you probably will want to later. Recommend using different pins for those LEDs.

thanks a lot, we will look at it when we have another lesson together. Here is a link to the schematic of the project

In the schematic the switches are wired with pulldown resistors so if you don't want to change the sketch you need to wire them like your schematic, not the one that I provided. So, on your breadboard, wire the top left terminal of the switch to 5V, the Arduino input and one end of the resistor to the bottom right terminal and the other end of the resistor to ground.

Thanks for the help!
we start to understand more and more about the arduino.
We looked at the blueprints of the project again and made some slight changes.
The only part we don't understand from your message is the part with the terminals. Could you please name us the parts like the terminal and the arduino power in the following image.

I would have a hard time editing the pictures so here is the switch with pull down in a schematic. It is important to use diagonal pins of the switch so there won't be a short.

pull down 2.jpg