Hello dear readers,
I'm embarking on an exciting project: building a prayer clock to assist believers in keeping track of their prayer times. But I need your help! The programming aspect has proven to be quite challenging. The clock should calculate prayer times based on geographical coordinates and display notifications. If you have experience with microcontrollers and time calculations, I encourage you to reach out. Together, we can bring this project to life.
The goal is to have the clock display prayer times on its screen. The following code currently displays the time, but there's still much work to be done.
#include "RTClib.h"
#include "LiquidCrystal_I2C.h"
// Name des RTC-Moduls
RTC_DS3231 rtc;
// Name des LCD-Moduls
LiquidCrystal_I2C lcd(0x3f, 20, 2);
void setup()
{
// RTC-Modul starten
rtc.begin();
/*
wenn Datum und Zeit nicht korrekt -> Datum/Zeit setzen
Jahr, Monat, Tag, Stunde, Minute, Sekunde
Beispiel: 2022 August 31. 10 Uhr 30 Minuten 30 Sekunden
rtc.adjust(DateTime(2022, 8, 31, 10, 31, 30));
*/
// LCD starten
lcd.init();
lcd.backlight();
}
void loop()
{
// aktuelle Zeit holen
DateTime aktuell = rtc.now();
// 1. Zeile
lcd.setCursor(0, 0);
char Datum[] = "DD.MM.YY";
// Datum in String umwandeln und anzeigen
//lcd.print(aktuell.toString(Datum));
// Format der Uhrzeit festlegen
char Zeit[] = "hh:mm:ss";
// gemessene Temperatur in String umwandeln
String Temperatur = String(rtc.getTemperature());
// angelsächsische Schreibweise der Temperatur
// . durch , ersetzen
float temperatur = rtc.getTemperature();
// Datum in String umwandeln und anzeigen
lcd.print(aktuell.toString(Datum))+ lcd.print(" ") + lcd.print(String(int(temperatur)) + "\337C");
// 2. Zeile
lcd.setCursor(0, 1);
// Sonderzeichen für ° = \337
// Temperatur anzeigen
lcd.print(aktuell.toString(Zeit));
delay(1000);
}
Thank you for your support!