//Define Pins
int greenLED = D6; // Set the LED pin
int yellowLED = D0; // Set the LED pin
int redLED = D7; // Set the LED pin
int button = 27; // Set the button pin

void setup() {
  pinMode(button, INPUT_PULLUP); // Set the LED pin

  //Initilize pins
  pinMode(greenLED, OUTPUT); 
  pinMode(yellowLED, OUTPUT);
  pinMode(redLED, OUTPUT);
  pinMode(button, INPUT_PULLUP);

  attachInterrupt(digitalPinToInterrupt(button), turnOnAll , RISING); 
  /*
    Attach an interrupt to a pin 
    ISR: Interrupt Service Routine - the function to call when the 
         interrupt occurs. 
    mode: Determines when the interrupt should be triggered. 
          Common modes include CHANGE, RISING, FALLING, and LOW.
  */
}


void loop() {
  digitalWrite(greenLED, HIGH); // green LED lights up with the value of HIGH 
  digitalWrite(redLED, LOW);
  digitalWrite(yellowLED, LOW);
  delay(1000);
  digitalWrite(yellowLED, HIGH); // yellow LED lights up with the value of HIGH
  digitalWrite(greenLED, LOW);
  digitalWrite(redLED, LOW);
  delay(1000);
  digitalWrite(redLED, HIGH); // red LED lights up with the value of HIGH
  digitalWrite(yellowLED, LOW);
  digitalWrite(greenLED, LOW);
  delay(1000);
}

// Code to execute when interrupt occurs

void turnOnAll() {
  // When the button is pressed all the LED's will ight up
  digitalWrite(redLED, HIGH);
  digitalWrite(yellowLED, HIGH);
  digitalWrite(greenLED, HIGH);
  delay(1000);
}  

A R D U I N O