#include <LiquidCrystal_I2C.h>
#include "MyButton.h"
#include "BT201.h"
LiquidCrystal_I2C lcd(0x27, 16, 2);

Button b[4] = {Button(2, INPUT_PULLUP), Button(3, INPUT_PULLUP), Button(4, INPUT_PULLUP), Button(5, INPUT_PULLUP)};

BT201 bt;
void setup() {
  bt.init();
  lcd.init();
  lcd.backlight();

}
bool mode;
void loop() {
  b[0].ShortPress([]() {
    bt.nextTrack();
  });
  b[1].ShortPress([]() {
    bt.prevTrack();
  });
  b[2].ShortPress([]() {
    bt.play_pause();
  });

  b[3].ShortPress([]() {
    mode = !mode;
    bt.switchMode(mode ? 'U' : 'B');
  });

  bt.getDataFromBt();
  lcd.setCursor(0, 0);
  lcd.print(bt.FileName.substring(0, 16));
  lcd.setCursor(0, 1);
  lcd.print(bt.FileName.substring(16) + "          ");

}