Arduino Counting
/*
A simple program designed to count in seconds without using the Millis function
The program displays this timer on an I2C LCD screen
Last modified - 01/06/2022
by Plasma
*/
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4); // 20 x 4 I2C LCD screen
LiquidCrystal_I2C lcd(0x27, 16, 2); // 16 x 2 I2C LCD screen
signed short hours, minutes, seconds;
char Total_Time[16];
void setup() {
lcd.init();
lcd.backlight();
lcd.clear();
}
void loop() {
lcd.setCursor(0,0);
sprintf(Total_Time, "%0.2d:%0.2d:%0.2d", hours, minutes, seconds);
lcd.print(Total_Time);
lcd.setCursor(0,2);
lcd.print("Your Name");
delay(1000);
seconds++;
if (seconds == 60) { // When seconds = 60
seconds = 0; // Seconds become 0
minutes ++; // Adds 1 minute
}
if (minutes == 60) { // When minutes = 60
minutes = 0; // Minutes become 0
hours ++; // Adds 1 hour
}
}
Plasma