#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,10,9,8,7);
void reset(){
lcd.setCursor(8,1);
lcd.print("");
lcd.setCursor(7,1);
lcd.print("");
}
void setup(){
pinMode(6, INPUT_PULLUP);
lcd.begin(16,2);
lcd.setCursor(3,0);
lcd.print("Stopwatch!");
}
void loop(){
String condition = "stop";
int time = 0;
if(digitalRead(6) == LOW && condition == "stop"){
reset();
if(condition == "stop"){
condition = "start";
while(condition == "start"){
if(digitalRead(6) == LOW && condition == "start"){
condition = "stop";
}
if(time < 10){
lcd.setCursor(8,1);
}
else{
lcd.setCursor(7,1);
}
lcd.print(time);
time++;
delay(1000);
}
}/*
else{
lcd.print(time);
condition = "stop";
}*/
}
}