int LED_PIN = 5;
int BUTTON_PIN = 8;
byte numbers[3] {0};
int user_input_timeout = 5000;

volatile int userClicks;

void setup() {
  Serial.begin(9600);
  enableOutputOn(LED_PIN);
  enableInputOn(BUTTON_PIN);

  initRandomNumbers();

  blinkWelcome();

  blinkSimonSays(numbers[0]);
}

// the loop function runs over and over again forever
void loop() {
  delay(150);
}

void enableOutputOn(int pin){
  pinMode(pin, OUTPUT);
}

void enableInputOn(int pin){
  pinMode(pin, INPUT);
}

void initRandomNumbers(){
  Serial.println(analogRead(1));
  randomSeed(analogRead(1));
  random(1, 8);
  numbers[0] = random(1, 8);
  numbers[1] = random(1, 8);
  numbers[2] = random(1, 8);
  Serial.println(numbers[0]);
  Serial.println(numbers[1]);
  Serial.println(numbers[2]);
}

void blinkYes(){
  blinkFast(2);
}

void blinkNo(){
  blinkSlow(1);
}

void blinkWelcome(){
  blinkFast(5);
  delay(1000);
}

void blinkSimonSays(int number){
  blink(number, 350);
}

void blinkFast(int count){
  blink(count, 150);
}

void blinkSlow(int count){
  blink(count, 1000);
}

void blink(int count, int delayMillis){
  for(int i = 0; i < count; i++) {
    blinkOnce(delayMillis);
  }
}

void blinkOnce(int delayMillis){
  digitalWrite(LED_PIN, HIGH);
  delay(delayMillis);
  digitalWrite(LED_PIN, LOW);
  delay(delayMillis);
}