jam digital
//-----www<electronics-project-hub>com------// video jam digital arduino https://youtu.be/s4Wa71g-u_c #include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2); int h = 12; int m = 0; int s = 0; int flag = 0; int TIME = 0; const int hs = A0; const int ms = A1; int state1 = 0; int state2 = 0; void setup() { lcd.init(); lcd.backlight(); pinMode(hs, INPUT_PULLUP); pinMode(ms, INPUT_PULLUP); } void loop() { lcd.setCursor(0, 0); s = s + 1; lcd.print("TIME:" ); lcd.print(h); lcd.print(":"); lcd.print(m); lcd.print(":"); lcd.print(s); if (flag < 12) lcd.print(" AM"); if (flag == 12) lcd.print(" PM"); if (flag > 12) lcd.print(" PM"); if (flag == 24) flag = 0; delay(1000); lcd.clear(); if (s == 60) { s = 0; m = m + 1; } if (m == 60) { ...
Komentar
Posting Komentar