// Bibliotheken
#include <LiquidCrystal_I2C.h>
#include <RTClib.h>
#include <Wire.h>
// Variablen
#define I2C_ADDR 0x27
#define LCD_COLUMNS 20
#define LCD_LINES 4
char daysOfTheWeek[7][12] = {"Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"};
// Objekte
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES);
RTC_DS1307 rtc;
void setup() {
// put your setup code here, to run once:
lcd.init();
lcd.backlight();
rtc.begin();
}
void loop() {
// put your main code here, to run repeatedly:
DateTime now = rtc.now();
lcd.setCursor(0,0); lcd.print("Datum: ");
lcd.print(now.day()); lcd.print(".");
lcd.print(now.month()); lcd.print(".");
lcd.print(now.year());
lcd.setCursor(0,1); lcd.print("Uhrzeit: ");
lcd.print(now.hour()); lcd.print(":");
lcd.print(now.minute()); lcd.print(":");
lcd.print(now.second());
lcd.setCursor(0,2);
lcd.print(daysOfTheWeek[now.dayOfTheWeek()]);
delay(100);
}