#include <Wire.h>
#include <LiquidCrystal_I2C.h>
int x;
long m,t;
int start;
LiquidCrystal_I2C lcd(0x27,16,2);
void setup(){
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
lcd.init();
lcd.backlight();
lcd.print(0);
}
void loop(){
if (digitalRead(2) == 0) {
while (digitalRead(2) == 0) {
delay(10);
}
if (start == 0){
start = 1;
t = millis();
lcd.clear();
lcd.print("...");
}
else {
start = 0;
lcd.clear();
m = m + (millis()-t)/1000;
lcd.print(m);
}
}
if (digitalRead(3) == 0){
lcd.clear();
lcd.print(0);
start = 0;
m = 0;
delay(100);
}
}