// https://forum.arduino.cc/t/easy-step-up-step-down-game-paid-help/1331759/
// https://forum.arduino.cc/t/step-up-step-down-game/1331747/

#include <FastLED.h> // http://fastled.io/docs/files.html

#define NUMPIX 8
#define PIXPIN 2
#define MAXBRIGHT 255 // pixel brightness, 0 - 255
CRGB pixel[NUMPIX]; // create object to control [pixel]

byte i; // indexer
byte buttonPin[] = {3, 4, 5};
byte buttons = sizeof(buttonPin) / sizeof(buttonPin[0]);
unsigned long counter;

unsigned long timer, timeout = 50;
bool currentButtonState, lastButtonRead;

void setup() {
  Serial.begin(115200);
  for (int i = 0; i < buttons; i++) {
    pinMode(buttonPin[i], INPUT_PULLUP);
  }

  FastLED.addLeds<WS2812B, PIXPIN, GRB>(pixel, NUMPIX);
  FastLED.setBrightness(MAXBRIGHT);
  FastLED.clear(); // empty pixel buffer
  FastLED.show(); // display empty buffer
}

void loop() {
  for (int i = 0; i < buttons; i++) {
    if (!digitalRead(buttonPin[i]))
      readButton(i);
  }
}

void climb() {
}

void ring() {
  // black to white, red sparkles
}

void readButton(byte pin) {
  bool currentButtonRead = digitalRead(buttonPin[pin]);                    // read button pin
  if (currentButtonRead != lastButtonRead) {                    // if button pin changes...
    timer = millis();                                           // ...start a timer
    lastButtonRead =
     currentButtonRead;                         // ... and store current state
    Serial.print(currentButtonRead);
  }
  if ((millis() - timer) > timeout) {                           // if button change was longer than debounce timeout
    if (currentButtonState == HIGH && lastButtonRead == LOW) {  // ... and State is "NOT pressed" while Button "IS PRESSED"
      //==================================================
      digitalWrite(LED_BUILTIN, HIGH);                          // The button was pressed...
      showButton(pin, ++counter);;                // Put actions or function calls here
      digitalWrite(LED_BUILTIN, LOW);
      //==================================================
    }
    currentButtonState = currentButtonRead;                     // update button state
  }
}

void showButton(int pin, int count) {
  // Serial.println(pin);
  // Serial.println(count);
}
UP
DOWN
SHOT
1000uF