Anak Kendali
3 min readMar 20

--

Tutorial Arduino RTC DS3231 dan LCD 16x2
Tutorial Arduino RTC DS3231 dan LCD 16x2

Langkah Tutorial Arduino Mengakses RTC DS3231

Tutorial Arduino Mengakses RTC DS3231 Mudah !!!
Rangkaian RTC DS3231 dan Arduino
Tutorial Arduino Mengakses RTC DS3231 Mudah !!!
Tutorial Arduino Mengakses RTC DS3231 Mudah !!!
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include "RTClib.h"
RTC_DS3231 rtc;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
#define tahun now.year()
#define bulan now.month()
#define tanggal now.day()
#define hari daysOfTheWeek[now.dayOfTheWeek()]
#define jam now.hour()
#define menit now.minute()
#define detik now.second()
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
char buff[10];
void setup()
{
// initialize the LCD
lcd.begin();
}
void loop()
{
DateTime now = rtc.now();
lcd.clear ();
sprintf (buff, "%02d:%02d", jam, menit);
lcd.setCursor (5, 0);
lcd.print(buff);
sprintf (buff, "%02d-%02d-%02d", tanggal, bulan, tahun);
lcd.setCursor(3, 1);
lcd.print(buff);
delay(100);
}
sprintf (buff, "%02d-%02d-%02d", tanggal, bulan, tahun);
Tutorial Arduino Mengakses RTC DS3231 Mudah !!!
Hasil Jam DIgital LCD RTC DS3231 dengan Arduino

Keyword

--

--

Anak Kendali
0 Followers

Learn microcontroller with anakkendali.com