/* PROGRAMMINFO Funktion: ESP32 Datum, Uhrzeit-Abrage Version: 08.03.2021 () C++ Arduino IDE V1.8.13 Board: ESP32vn IoT UNO V1.0.4 Einstellungen: https://dl.espressif.com/dl/package_esp32_index.json http://dan.drown.org/stm32duino/package_STM32duino_index.json https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json Librarys - WiFi.h V0.16.1 */ #include #include #include const char *ssid = "xxx"; const char *password = "xxx"; //Zeitverschiebung UTC <-> MEZ (Winterzeit) = 3600 Sekunden (1 Stunde) //Zeitverschiebung UTC <-> MEZ (Sommerzeit) = 7200 Sekunden (2 Stunden) const long utcOffsetInSeconds = 3600; char daysOfTheWeek[7][12] = {"Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"}; WiFiUDP ntpUDP; NTPClient timeClient(ntpUDP, "pool.ntp.org", utcOffsetInSeconds); void setup(){ Serial.begin(115200); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Ich verbinde mich mit dem Internet..."); } Serial.println("Ich bin mit dem Internet verbunden!"); timeClient.begin(); } void loop() { timeClient.update(); Serial.print(daysOfTheWeek[timeClient.getDay()]); Serial.print(", "); Serial.println(timeClient.getFormattedTime()); delay(1000); }