#include <LiquidCrystal.h>
#define BUTTON_PIN 2
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
bool running = false;
byte lastButtonState = LOW;
void setup() {
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  // put your setup code here, to run once:
  lcd.begin(16, 2);
  // you can now interact with the LCD, e.g.:
  lcd.print("Hello World!");
}
void loop() {
  // put your main code here, to run repeatedly:
  const unsigned int bpm = 94;
  const float mpb = 1.0f / ((float)bpm);
  const float mspb = mpb * 60000.0f;
  const float msDelay = mspb / 2.0f;
  byte buttonState = digitalRead(BUTTON_PIN);
  if (lastButtonState == HIGH && buttonState == LOW) {
    running = !running;
  }
  lastButtonState = buttonState;
  lcd.clear();
  if (running) {
    lcd.print("Running...");
    digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(msDelay);                       // wait for a second
    digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
    delay(msDelay); 
  } else {
    lcd.print("Not running");
    digitalWrite(LED_BUILTIN, LOW);
  }
}