hi i am trying out a project and i am getting an error i have had a look on google ect and i can not find what i have done wrong can you spot it ? thank you for looking the i have marked the bit with the error
// project 5 -controlling traffic
// define all pins thar the buttons and lights are on
#define westButton 3
#define eastButton 13
#define westRed 2
#define westYellow 1
#define westGreen 0
#define eastRed 12
#define eastYellow 11
#define eastGreen 10
#define yellowBlinkTime 500//0.5 seconds for yell ow light blink
boolean trafficWest = true; //west = true, est = false
int flowTime = 10000; //amount of time to let traffic flow
int changeDelay = 2000;// amount of time between color chsnges
void setup ()
{// set 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 >est traffic flow
if (trafficWest != true)// only cotinue traffic flowing in the opposite (east ) direction
{ trafficWest = true;//change traffic flow flag to west >east
delay (flowTime); // give time for tarric 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);// chang west-facing Lights from red to green
digitalWrite (westGreen,HIGH);
}
}
if(digitalRead (eastButton) == HIGH ) // request east>west traffic flow <<<<<<<<<<THIS IS THE BIT WITH THE ERROR
{
if (trafficWest == true)// only continue if traffic is .wesr
//give time for traffic to flowin the opposit (west )direction
{
trafficWest =false;// change traffic flow flag to easr
delay (flowTime);//give time for traffic to flow
digitalWrite(westGreen, LOW);//change west light 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 ;++)
// blink yellow light
{
digitalWrite(eastYellow, LOW);
delay (yellowBlinkTime);
digitalWrite(eastYellow, HIGH);
delay (yellowBlinkTime);
digitalWrite(eastYellow, LOW);
digitalWrite(eastRed, LOW);
digitalWrite(eastGreen,HIGH);
}
}
}