Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Simple Digital Timer Without RTC
- * Created 16 March 2018
- * By Papermindvention.blogspot.com
- */
- #include <LiquidCrystal.h>
- /*pin yang digunakan oleh lcd
- * 6 (RS)
- * 7 (E/Enable)
- * 9 (DB4)
- * 10 (DB5)
- * 11 (DB6)
- * 12 (DB7)
- */
- LiquidCrystal lcd(6, 7, 9, 10, 11, 12);
- int jam = 0; //Variable untuk data Jam
- int menit = 0;
- int detik = 0;
- void setup(){
- lcd.begin(16, 2); //Mengaktifkan LCD
- }
- void loop(){
- for (detik = 0; detik <= 60; detik +=1){
- lcd.clear(); //Membersihkan karakter pada LCD
- lcd.print(jam); lcd.print(':'); //mencetak karakter di LCD
- lcd.print(menit); lcd.print(':');
- lcd.print(detik);
- delay(1000);
- if (detik == 60){ //Me-reset detik
- detik = 0;
- menit +=1; }
- if (menit == 60){
- menit = 0;
- jam +=1;}
- if (jam == 24){
- jam = 0;}}
- }
Advertisement
Add Comment
Please, Sign In to add comment