// Arduino IDE 1.8.9
// Sketch uses 1696 bytes (5%) of program storage space.
// Global variables use 30 bytes (1%) of dynamic memory,
#include <Bounce2.h>
const byte ledPin1 = 4;
const byte ledPin2 = 5;
const byte buttonPin1 = 8;
const byte buttonPin2 = 9;
const byte sequenceLength = 4;
byte sequence[sequenceLength];
byte counter = 0;

Bounce button1 = Bounce();
Bounce button2 = Bounce();

void setup(){

  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  digitalWrite(ledPin1, LOW);
  digitalWrite(ledPin2, LOW);

  pinMode(buttonPin1, INPUT_PULLUP);
  pinMode(buttonPin2, INPUT_PULLUP);

  button1.attach(buttonPin1);
  button1.interval(50);
  button2.attach(buttonPin2);
  button2.interval(50);

}

void loop(){

  if(button1.update()){
    if(button1.read() == 0){
      addToSequence(ledPin1);
    }
  }

  if(button2.update()){
    if(button2.read() == 0){
      addToSequence(ledPin2);
    }
  }

  if(counter == sequenceLength){
    for(byte i = 0; i < sequenceLength; i++){
      if(sequence[i] == ledPin1){
        digitalWrite(ledPin1, HIGH);
        digitalWrite(ledPin2, LOW);
      }
      else{
        digitalWrite(ledPin1, LOW);
        digitalWrite(ledPin2, HIGH);
      }
      delay(500);
      digitalWrite(ledPin1, LOW);
      digitalWrite(ledPin2, LOW);
      delay(500);
    }
    counter = 0;
  }
}

void addToSequence(byte pinNumber){
  sequence[counter] = pinNumber;
  counter++;
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
led1:A
led1:C
led2:A
led2:C
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
btn2:1.l
btn2:2.l
btn2:1.r
btn2:2.r
r1:1
r1:2
r2:1
r2:2