#include "Reel.h"
#include <Bounce2.h>
#include <LiquidCrystal_I2C.h>

# define SPIN_PIN 11

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

Reel reel1(200,10,6,7,8,9);
Reel reel2(200,10,2,3,4,5);
//Bounce spinBtn = Bounce();
Bounce2::Button spinBtn = Bounce2::Button();

void setup() {
  Serial.begin(115200);

  lcd.init();                      // initialize the lcd 
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("LOADING");
  
  spinBtn.attach(SPIN_PIN, INPUT_PULLUP);
  reel1.init();
  reel2.init();
}

void loop() 
{
  spinBtn.update();
  reel1.update();
  reel2.update();


  if ( spinBtn.pressed() ) { 
    lcd.setCursor(3,0);
    lcd.print("SPIN");
    reel1.startSpin(10, 200);
    reel2.startSpin(10, 400);
  }

}