Bel Sekolah Otomatis Dengan Arduino Uno
Bel Sekolah Otomatis Dengan Arduino Uno
05
view source
print?
01 /* Program Bel Sekolah Otomatis dibuat oleh Indobot */
02
03 #include <LiquidCrystal_I2C.h> //Library LCD I2C
04 LiquidCrystal_I2C lcd(0x27,16,2); //Alamat I2C
05
06 #include <DS3231.h> //library DS3231
07 DS3231 rtc(SDA, SCL); //inisialisasi penggunaan i2c
08 Time t; //Variabel t tampat menyimpan waktu
09 int set_jam = 07; //Set alarm jam
10 int set_menit = 00; //Set alarm menit
11
12 #define Buzzer 2 //Buzzer pada pin D2
13 bool buzz = false;
14
15 void setup()
16 {
17 lcd.init (); //Mulai LCD
18 lcd.setBacklight(HIGH);
19
20 rtc.begin(); //Mulai RTC
21
22 //setting pertama download program
23 rtc.setDate(30, 9, 2020); //mensetting tanggal
24 rtc.setTime(06, 59, 50); //menset jam
25 rtc.setDOW(3); //menset hari "Rabu"
26
27 //setelah didownload awal selesai, download kedua dengan memberi tanda komen "//"
28 pinMode(Buzzer, OUTPUT);
29 }
30
31 void loop()
32 {
33 lcd.setCursor(0,0);
34 lcd.print(rtc.getDateStr()); //prosedur pembacaan tanggal
35
36 lcd.setCursor(0,1);
37 lcd.print(rtc.getTimeStr()); //prosedur pembacaan waktu
38
https://indobot.co.id/blog/bel-sekolah-otomatis/ Page 1 of 2
09/08/23 13.05
https://indobot.co.id/blog/bel-sekolah-otomatis/ Page 2 of 2