// MUHAMMAD FAHMAN BIN ROSLAN (52224122456)
// UNIKL MIIT
// LED1 is pedestrian RED light, LED2 is pedestrian GREEN light, RGB LED is motorist GREEN, RED, AND YELLOW light

int LED1 = 3; // pedestrian red
int LED2 = 2; // pedestrian green

const int RED = 11; // motorist yellow
const int GREEN = 12;
const int BLUE = 13;

const int Button_Pin = 8;

void setup() {
  // put your setup code here, to run once:
  pinMode(8, INPUT);
  pinMode(3, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(RED, OUTPUT);
  pinMode(GREEN, OUTPUT);
  pinMode(BLUE, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  if(digitalRead(Button_Pin) == HIGH){
    delay(5000);
    digitalWrite(3, HIGH);
    digitalWrite(2, LOW);
    digitalWrite(RED, 255);
    digitalWrite(GREEN, 230);
    digitalWrite(BLUE, 0);
    delay(5000);
    digitalWrite(3, LOW);
    digitalWrite(2, HIGH);
    digitalWrite(RED, 255);
    digitalWrite(GREEN, 0);
    digitalWrite(BLUE, 0);
    delay(20000);
    digitalWrite(2, LOW);
    delay(1000);
    digitalWrite(2, HIGH);
    delay(1000);
    digitalWrite(2, LOW);
    delay(1000);
    digitalWrite(2, HIGH);
    delay(1000);
    digitalWrite(2, LOW);
    delay(1000);
    digitalWrite(2, HIGH);
    delay(5000);
    digitalWrite(RED, 0);
    digitalWrite(GREEN, 255);
    digitalWrite(BLUE, 0);
  }
  else{
    digitalWrite(3, HIGH);
    digitalWrite(2, LOW);
    digitalWrite(RED, 0);
    digitalWrite(GREEN, 255);
    digitalWrite(BLUE, 0);
  }
}