I have written a code for a stopwatch (when button pressed, it starts), but I have used delay(). Is there a way to perform it without delay()?
lcd.setCursor(0, 1);
if (buttonValue1 == LOW) {
startTime = millis();
timerMode++;
delay(400);
}
if (timerMode == 1) {
lcd.setCursor(0, 1);
lcd.print("Time : ");
lcd.setCursor(7, 1);
lcd.print((millis() - startTime) / 1000.0);
lcd.setCursor(12, 1);
lcd.print(" sec");
}
if (timerMode > 1) {
delay(6000);
timerMode = 0;
lcd.clear();
lcd.setCursor(3, 0);
lcd.print("TIMER");