Traffic controller code - error

So im having an error each time i try to verify this code. It says “exit status 1 - “HIGH” was not declared in this scope.” and its referencing the 28th line. Where would I declare HIGH?

/*
 * Traffic Light
 */
 int carRed = 12; //assign the car lights
 int carYellow = 11;
 int carGreen = 10;
 int button = 9; //button pin
 int pedRed = 8; //assign the pedestrian lights
 int pedGreen = 7;
 int crossTime =5000; //time for pedestrian to cross
 unsigned long changeTime;//time since button pressed
 
void setup() {
  //configure all LED's as output
pinMode(carRed, OUTPUT);
pinMode(carYellow, OUTPUT);
pinMode(carGreen, OUTPUT);
pinMode(pedRed, OUTPUT);
pinMode(pedGreen, OUTPUT);
pinMode(button, INPUT); //configure button as input
digitalWrite(carGreen, HIGH); //turn on the green lights
digitalWrite(pedRed, LOW); //initialize red pedestrian light off
}

void loop() {
int state = digitalRead(button);
//check if button is pressed it is over 5 seconds since last button press
if(state == High && (millis() - changeTime)> 5000){
  //call the function to change the lights
  changeLights();
}
}
void changeLights() {
  digitalWrite(carGreen, LOW); //greeen off
  digitalWrite(carYellow, HIGH); //yellow on
  delay(2000); //wait 2 seconds

  digitalWrite (carYellow, LOW); //yelllow off
  digitalWrite (carRed, HIGH); //red on
  delay(1000); //wait 1 second till it's safe

  digitalWrite(pedRed, LOW); //ped red off
  digitalWrite(pedGreen, HIGH); //ped green on

  delay(crossTime); //wait for preset time period

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

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

  digitalWrite(carRed, LOW);//red off
  digitalWrite(carYellow, HIGH); //yellow on
  delay(1000);
  digitalWrite(carYellow, LOW); //yellow off
  digitalWrite(carGreen, HIGH);

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

C is case-sensitive. You didn't declare "High". You probably meant "HIGH".

iramos85:
So im having an error each time i try to verify this code. It says "exit status 1 - "HIGH" was not declared in this scope." and its referencing the 28th line. Where would I declare HIGH?

No, it does not give that error message.

C:\Users\sterretje\AppData\Local\Temp\arduino_bf0fe974ce61c5f0b377bbc8eca91f93\sketch_feb26a.ino: In function 'void loop()':

sketch_feb26a:28: error: 'High' was not declared in this scope

 if(state == High && (millis() - changeTime)> 5000){

             ^

exit status 1
[b][color=red]'High'[/color][/b] was not declared in this scope

You have to be accurate :wink:

I updated that "High" to "HIGH". Thanks everyone, I'm starting to pick up on how accurate i am supposed to be. Thanks again!