// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// CLOCK NTP: Clock with online data from pool.ntp.org 4 DISPLAYS Jan.2024
// ========= I2C displays: works with LCD display 16x2 AND with OLED display 128x64 (I2C)
// SPI displays: works with TFT display 240x320 AND with ePaper display 128x296
//
// Hardware: ESP32-S3 44pin,
// Display: OLED display 128x64 I2C, LCD display 16x2 I2C, TFT display 240x320 SPI, EPAPER display 128x296 SPI
// Libraries: u8g2lib.h (OLED), LiquidCrystal_I2C.h (LCD), Adafruit_ILI9341.h (TFT), GxEPD.h (ePaper)
// Processor: Selection in Arduino IDE: ESP32S3 Dev Module
// Possible Touch Pins for ESP32S3 44pin: GPIO #: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
// Possible Output Pins for ESP32S3 44pin: GPIO #: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 46
// 0 1 2 19 20 21 35 36 37 38 39 40 41 42 43 44 45 47 48 48 (or38?): internal RGB LED
// to be added:
// -
// -
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// TFT ILI9341 Full color 240x320 2.8" LCD-TFT display with SPI interface
// # Name==Description===========ESP32S3/44==ESP32_urish==Arduino Uno============
// 1 VCC Supply voltage 5V 5V 5V
// 2 GND Ground GND GND GND
// 3 CS Chip select 10 15 10† † You connect CS and D/C to any digital Arduino pin. The pin numbers here are just an example.
// 4 RST Reset* 13 4 - * The RST and backlight (LED) pins are not available in the simulation.
// 5 D/C DC Data/command 14 2 9† † You connect CS and D/C to any digital Arduino pin. The pin numbers here are just an example.
// 6 MOSI DIN data (MCU→LCD) 11 23 11
// 7 SCK CLK clock 12 18 13
// 8 LED Backlight LED* - - 5V * The RST and backlight (LED) pins are not available in the simulation.
// 9 MISO SPI data (LCD→MCU)‡ - (9?) 19 12 ‡ You can leave MISO disconnected, unless you need to read data back from the LCD.
//
//
// E-Paper ---> 2.90" 128x296 or 2.13" inch e-paper SPI
// ePaper========>===ESP32s3/44==ESP32=====ESP32_Wokwi====Zingg====Lolin32==D32 Pro==TTGO T8 ESP32 WROVER==
// BUSY MISO?----> - (9?46?) 4 arbitr 4 4 4 4 15 4
// RST -----> 13 16 arbitr "RX2"! 21 21 16 0 0
// DC D/C -----> 14 17 arbitr "TX2"! 19 22 17 2 2
// CS -----> 10 5 SS arb 5 5 5 SS(5) 5 SS(5)
// CLK SCK -----> 12 HW! 18 HW! 18 18 18 18 18 18
// DIN MOSI -----> 11 HW! 23 HW! 23 23 23 23 23 23
// GND -----> GND
// 3V3 -----> VCC
// *****************************************************************************************************
/* alternative sketch from Enyoy Mechatronics:
#include <WiFi.h>
#include <Time.h>
#include <sntp.h.h>
const char* ssid = ("Wokwi-GUEST");
const char* password = ("");
//WiFi.begin("Wokwi-GUEST", "", 6); // WiFi.begin("Wokwi-GUEST", ""); Opt. channel (6) means: skip WiFi scanning phase, save ~4 seconds when connecting to the WiFi.
const char* ntpServer1 = "pool.ntp.org"; // NTP time server
const char* ntpServer2 = "time.nist.gov";
const long gmtOffset_sec = 3600; // 3600 (sec) add 1 hour offset to GMT/UTC
const int daylightOffset_sec = 3600; // 3600 (sec) mean: summer/winter 1h difference, daylight offset
const char* timezone = "CET-1CEST,M3.5,M10.5.0/3"; // TimeZone rule for Europe/Rome incl. daylight
void printLocalTime()
{ struct tm timeinfo;
if(!getLocalTime(&timeinfo))
{ Serial.println("No time available (yet)");
return:
}
Serial.println(&timeinfo, "%A, %Bm %d %Y %H:%M:%S");
// %A full weekday, %B full month, %d day of month, %Y year, %H hour 24h, %I hour 12h, %M minute, %S second
}
void timeavailable(struct timeval *t) // Callback function (gets called when time adjusts via NTP)
{ Serial.println("Got time adjustment from NTP!");
printLocalTime();
}
void setup()
{ Serial.begin(115200);
sntp_set_time_sync_notification_cb(timeavailable); // set notification call-back function
sntp_servermode_dhcp(1); // optional
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer1, ntpServer2);
Serial.printf("Connecting to %s ", ssid);
WiFi.begin(ssid, password);
while (WiFi.status() !=WL_CONNECTED)
{ delay(500);
Serial.print(".");
}
Serial.println(" CONNECTED");
}
void loop()
{ delay(5000);
printLocalTime();
}
*/
/*
You can use the Adafruit_ILI9341 library or the lcdgfx library to interface with the LCD display.
The following code example shows basic usage with Adafruit_ILI9341. It works with the pin connections from the table above:
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define TFT_DC 9
#define TFT_CS 10
Adafruit_ILI9341 TFT = Adafruit_ILI9341(TFT_CS, TFT_DC);
void setup() {
TFT.begin();
TFT.setCursor(26, 120);
TFT.setTextColor(ILI9341_RED);
TFT.setTextSize(3);
TFT.println("Hello, TFT!");
TFT.setCursor(20, 160);
TFT.setTextColor(ILI9341_GREEN);
TFT.setTextSize(2);
TFT.println("I can has colors?");
}
void loop() { }
*/
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// **************************************************************************************************
// D E F I N I T I O N S *
// **************************************************************************************************
#include <WiFi.h>
#include <Wire.h> // ? needed for I2C?
#include "SPI.h" // needed for TFT and sPaper display with SPI?
#include "U8g2lib.h" // library for OLED I2C, e.g. 128x64 monochrome
// ===== CONSTRUCTOR in Wokwi apparently needs ESP32s3/44p Hardware pins 8 (data) and 9 (clock) for I2C. Display name "OLED"
U8G2_SSD1306_128X64_NONAME_F_HW_I2C OLED(U8G2_R0); // [full framebuffer, size = 1024 bytes], note that taking screenshow with OLED only works with fullscreen buffer
// ===== CONSTRUCTOR for OLED display with OLED library, SCL clock and SDA data pins can be software
//#define SDA 8 // GPIO08 I2C HW! SDA data
//#define SCL 9 // GPIO09 I2C HW! SCL clock
//U8G2_SSD1306_128X64_NONAME_F_SW_I2C OLED(U8G2_R0, SCL, SDA, U8X8_PIN_NONE); // constructor for 0.96" OLED I2C display 0x3C SSD1306 (or SSD1315), display name "displayOLED"
//U8G2_SSD1309_128X64_NONAME0_F_SW_I2C u8g2_2(U8G2_R0, SCL2, SDA2, U8X8_PIN_NONE); // constructor for 2.42" OLED I2C display SSD1309, display name "display2"
//U8G2_SSD1306_128X64_NONAME_F_SW_I2C OLED(U8G2_R0, SCL, SDA, U8X8_PIN_NONE); // constructor for 0.96" OLED I2C display 0x3C SSD1306 (or SSD1315), display name "display"
#include <LiquidCrystal_I2C.h> // library for LCD 16x2, I2C
// ===== Constructor in Wokwi apparently needs ESP32s3 Hardware pins 8 (data) and 9 (clock):
LiquidCrystal_I2C LCD = LiquidCrystal_I2C(0x27, 16, 2); // Constructor for LCD 16x2 with I2C address 0x27 (as Wokwi) display name "LCD"
#include "Adafruit_ILI9341.h" // library for TFT display with ILI9341
#include "Adafruit_GFX.h" // needed? Core graphics library
// ===== CONSTRUCTOR in Wokwi apparently needs Hardware pins 11 (data) and 12 (clock) and 13 (RST), CS and DC can be defined, LED and MISO unconnected
#define CS 10 // CS chipsel pin# std.S3 10 (ESP32 5)
#define DC 14 // DC datcom pin# std.S3 14 (ESP32 2)
Adafruit_ILI9341 TFT = Adafruit_ILI9341(CS, DC); // Hardware Constructor for TFT ILI9341 Full color 240x320 2.8" display with SPI interface
// ===== CONSTRUCTOR might need ESP32s3/44p Hardware pins 11 (data) / 12 (clock) / 13 (RST), CS and DC can be defined, LED and MISO unconnected
//#define CS 10 // CS chipsel pin# std.S3 10 (ESP32 5)
//#define DC 14 // DC datcom pin# std.S3 14 (ESP32 2)
//#define MOSI 11 // MOSI data pin# std.S3 11 (ESP32 23)
//#define CLK 12 // CLK clock pin# std.S3 12 (ESP32 18)
//#define RST 13 // RST reset pin# std.S3 13 (ESP32 16)
//#define MISO -1? 3 ? // MISO unconnected or e.g. pin# std.S3 3 (ESP32 ?)
//Adafruit_ILI9341 TFT = Adafruit_ILI9341(CS, DC, MOSI, CLK, RST, MISO); // Software Constructor for TFT ILI9341
//Adafruit_ILI9341 TFT = Adafruit_ILI9341(CS, DC); // Hardware constructor (11 data) (12 clock) (13 RST)
//
// ===== Versuch mit alter GxEPD.h library für e-Paper display==========================================
#include <GxEPD.h> // library for ePaper display, Jean-Marc Zingg. NEW: GxEPD2
#include <GxGDEM029T94/GxGDEM029T94.h>
#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <GxIO/GxIO.h>
#include <SPI.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
// ===== CONSTRUCTOR in Wokwi might need Hardware pins 11 (data) and 12 (clock) and 13 (RST), CS and DC can be defined, MISO -1
//#define CS 10 // 10 CS 5 pin# std.S3 10 (ESP32 5)
//#define DC 14 // 14 DC 22 pin# std.S3 14 (ESP32 2)
#define RST 13 // 13 RST 21 pin# std.S3 13 (ESP32 0)
#define BUSY 46 // 46 BUSY 4 pin# std.S3 9 or 46 (ESP32 4)
#define MOSI 11 // 11 MOSI Data 23 HW pin# std.S3 11 (ESP32 23)
#define SCLK 12 // 12 CLK Clock 18 HW pin# std.S3 12 (ESP32 18)
//#define MISO -1 // -1 MISO - pin# std.S3 - (ESP32 -)
GxIO_Class io(SPI, CS, DC, RST); // GxIO_Class io(SPI, EPD_CS, EPD_DC, EPD_RSET);
GxEPD_Class EPAPER(io, RST, BUSY); // GxEPD_Class EPAPER(io, EPD_RSET, EPD_BUSY); name "EPAPER"
// ====================================================================================================
//
/*
// ===== Versuch mit neuer GxEPD2.h library für e-Paper display==========================================
// NICHT ERFOLGREICH! Wokwi scheint dafür nicht eingerichtet
#include <GxEPD2_BW.h> // library for ePaper display, Wokwi 2.90" 128x296 (black&white? 3 colors?)
#include <GxEPD2_3C.h>
#include <GxEPD2_7C.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Adafruit_GFX.h> // Core graphics library
//#define CS 10 // CS pin# std.S3 10 (ESP32 5) already defined above for IL9341 constructor for TFT display
//#define DC 14 // DC pin# std.S3 14 (ESP32 2) already defined above for IL9341 constructor for TFT display
#define RST 13 // RST pin# std.S3 13 (ESP32 0)
#define BUSY 46 // BUSY pin# std.S3 9 or 46 (ESP32 4)
*/
// ===== Constructor in Wokwi needs ??? Hardware pins 11 (data) and 12 (clock), CS, DC, RST, BUSY can be defined:
// alternately you can copy the constructor from GxEPD2_display_selection.h or GxEPD2_display_selection_added.h to here
//GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(CS, DC, RST, BUSY)); // GDEH029A1 128x296, SSD1608 (IL3820)
// e.g. for 2.9" and #if defined(ESP32) && defined(ARDUINO_ESP32_DEV):
//GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=5*/ 5, /*DC=*/ 2, /*RST=*/ 0, /*BUSY=*/ 4)); // GDEH029A1 128x296, SSD1608 (IL3820)
//GxEPD2_BW<GxEPD2_290_T5, GxEPD2_290_T5::HEIGHT> display(GxEPD2_290_T5(/*CS=5*/ 5, /*DC=*/ 2, /*RST=*/ 0, /*BUSY=*/ 4)); // GDEW029T5 128x296, UC8151 (IL0373)
//GxEPD2_BW<GxEPD2_290_T5D, GxEPD2_290_T5D::HEIGHT> display(GxEPD2_290_T5D(/*CS=5*/ 5, /*DC=*/ 2, /*RST=*/ 0, /*BUSY=*/ 4)); // GDEW029T5D 128x296, UC8151D
//GxEPD2_BW<GxEPD2_290_I6FD, GxEPD2_290_I6FD::HEIGHT> display(GxEPD2_290_I6FD(/*CS=5*/ 5, /*DC=*/ 2, /*RST=*/ 0, /*BUSY=*/ 4)); // GDEW029I6FD 128x296, UC8151D
//GxEPD2_BW<GxEPD2_290_T94, GxEPD2_290_T94::HEIGHT> display(GxEPD2_290_T94(/*CS=5*/ 5, /*DC=*/ 2, /*RST=*/ 0, /*BUSY=*/ 4)); // GDEM029T94 128x296, SSD1680
//GxEPD2_BW<GxEPD2_290_T94_V2, GxEPD2_290_T94_V2::HEIGHT> display(GxEPD2_290_T94_V2(/*CS=5*/ 5, /*DC=*/ 2, /*RST=*/ 0, /*BUSY=*/ 4)); // GDEM029T94 128x296, SSD1680, Waveshare 2.9" V2 variant
//GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=5*/ 5, /*DC=*/ 2, /*RST=*/ 0, /*BUSY=*/ 4)); // DEPG0290BS 128x296, SSD1680
//GxEPD2_BW<GxEPD2_290_M06, GxEPD2_290_M06::HEIGHT> display(GxEPD2_290_M06(/*CS=5*/ 5, /*DC=*/ 2, /*RST=*/ 0, /*BUSY=*/ 4)); // GDEW029M06 128x296, UC8151D
//GxEPD2_BW<GxEPD2_290_GDEY029T94, GxEPD2_290_GDEY029T94::HEIGHT> display(GxEPD2_290_GDEY029T94(/*CS=5*/ 5, /*DC=*/ 2, /*RST=*/ 0, /*BUSY=*/ 4)); // GDEY029T94 128x296, SSD1680, (FPC-A005 20.06.15)
// GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW029Z10 128x296, UC8151 (IL0373)
//GxEPD2_3C<GxEPD2_290_Z13c, GxEPD2_290_Z13c::HEIGHT> display(GxEPD2_290_Z13c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH029Z13 128x296, UC8151D
//GxEPD2_3C<GxEPD2_290_C90c, GxEPD2_290_C90c::HEIGHT> display(GxEPD2_290_C90c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEM029C90 128x296, SSD1680
#define NTP_SERVER "pool.ntp.org" // NTP time server
#define UTC_OFFSET 3600 // 3600 (sec) add 1 hour offset to GMT/UTC
#define UTC_OFFSET_DST 3600 // 3600 (sec) mean: summer/winter 1h difference, daylight offset
// ===== LEFT ROW: INPUTS/OUTPUTS for ESP32-S3 44pin ==================================
// 3.3V
// 3.3V
// RST
// GPIO04 touch ADC
// GPIO05 touch ADC
// GPIO06 touch ADC
// GPIO07 touch ADC
// GPIO15 ADC
// GPIO16 ADC
// GPIO17 ADC
// GPIO18 ADC
// GPIO08 touch ADC I2C HW! SDA data
// GPIO03 touch ADC
// GPIO46 no ADC! (SPI BUSY?)
// GPIO09 touch ADC SPI BUSY Busy, I2C HW! SCL clock
// GPIO10 touch ADC SPI CS chip select
// GPIO11 touch ADC SPI HW! DIN/SDI MOSI Hardware data!
// GPIO12 touch ADC SPI HW! CLK SCLK Hardware clock!
// GPIO13 touch ADC SPI RST Reset
// GPIO14 touch ADC SPI DC D/C data command
// 5.0V
// GND
// ===== RIGHT ROW: INPUTS/OUTPUTS ===================================
// GND
// GPIO43 TX avoid
// GPIO44 RX avoid
// GPIO01 touch ADC
// GPIO02 touch ADC
// GPIO42
// GPIO41
// GPIO40
// GPIO39
// GPIO38 RGB LED
// GPIO37
// GPIO36
// GPIO35
// GPIO00 avoid
// GPIO45
// GPIO48
// GPIO47
// GPIO21
// GPIO20 ADC
// GPIO19 ADC
// GND
// GND
// ===== VARIABLES: ================================================================================
int hrs=0; // starting values for definition
int mins=0;
int secs=0;
int cnt; // counter zum Testen des Beispiels mit alter GxEPD library für ePaper
// **************************************************************************************************
// F U N C T I O N S *
// **************************************************************************************************
/*
void spinner() // no clue... while waiting for WiFi?
{ static int8_t counter = 0;
const char* glyphs = "\xa1\xa5\xdb";
LCD.setCursor(15, 1);
LCD.print(glyphs[counter++]);
if (counter == strlen(glyphs))
{ counter = 0; }
}
*/
void printLocalTime() // print time on LCD
{ struct tm timeinfo;
if (!getLocalTime(&timeinfo))
{ LCD.setCursor(0, 1);
LCD.println("Connection Err");
return;
}
LCD.setCursor(8, 0);
LCD.println(&timeinfo, "%H:%M:%S");
LCD.setCursor(0, 1);
LCD.println(&timeinfo, "%d/%m/%Y %Z");
}
// %A/a full/short weekday, %B/b full/short month, %d day of month, %Y year, %H hour 24h, %I hour 12h, %M minute, %S second, %Z UTC
void printTime_OLED() // print time on OLED
{ struct tm timeinfo;
if (!getLocalTime(&timeinfo))
{ OLED.setCursor(10, 30);
OLED.println("Connection Err");
return;
}
hrs = timeinfo.tm_hour;
mins = timeinfo.tm_min;
secs = timeinfo.tm_sec;
OLED.setFont(u8g2_font_profont11_tr);
OLED.setCursor(0, 45);
OLED.print(&timeinfo, "%H:%M:%S");
OLED.setCursor(0, 60);
OLED.print(&timeinfo, "%a %d.%m.%Y %b");
OLED.setCursor(110, 15);
OLED.print(secs);
OLED.sendBuffer(); // send buffer from RAM to display controller
}
// **************************************************************************************************
// S E T U P *
// **************************************************************************************************
void setup()
{
Serial.begin(115200);
LCD.init(); // LCD begin LiquidCrystal_I2C.h named "LCD" for 16x2 LCD
LCD.backlight();
LCD.setCursor(0, 0);
LCD.print("Connecting to ");
LCD.setCursor(0, 1);
LCD.print("WiFi ");
OLED.begin(); // OLED begin U8g2lib.h named "OLED" for OLED 128x64
//OLED.setFontMode(0); // optional: activate (1) or deactivate (0) transparent font mode (background shines through or not). Default: 0
//OLED.setDrawColor(1); // optional: color index for all drawing functions (text and boxes). Default: 1. black (0: white, 2: always reversed white on black/black on white)
//OLED.setBitmapMode(0); // optional: bitmap functions write background color (mode 0/solid, not transparent) or (mode 1/transparent, overlay). Default: 0
OLED.clearBuffer(); // clear buffer for storing display content in RAM
OLED.setDrawColor(1); // set color to white
//OLED.drawCircle(64, 60, 59, U8G2_DRAW_UPPER_LEFT | U8G2_DRAW_UPPER_RIGHT); // draw big semicircles for gauge outline
//OLED.drawCircle(64, 60, 57, U8G2_DRAW_UPPER_LEFT | U8G2_DRAW_UPPER_RIGHT); // draw big semicircles for gauge outline
//OLED.setFont(u8g2_font_profont11_tr); // set font for small digits
OLED.setFont(u8g2_font_profont10_tr); // font for the small label, e.g. "POWER"
//strcpy(string_buffer, "POWER"); // write label to buffer
//OLED.drawStr(10, 10, string_buffer); // place label centered
OLED.drawStr(0, 10, "Connecting to WiFi..."); // write some stuff
OLED.sendBuffer(); // send buffer from RAM to display controller
TFT.begin(); // TFT begin TFT display ILI9341 Full color 240x320 2.8" SPI
TFT.setRotation(1); // vertical (0), horizontal (1), vertical down (2), horizontal down (3), vertical (4)
TFT.fillScreen(ILI9341_BLACK); // screen color standard: TFT.fillScreen(ILI9341_BLACK); BLUE, WHITE, ...
TFT.setCursor(26, 120);
TFT.setTextColor(ILI9341_RED);
TFT.setTextSize(3);
TFT.println("Hello, TFT!");
TFT.setCursor(20, 160);
TFT.setTextColor(ILI9341_GREEN);
TFT.setTextSize(2);
TFT.println("I can has colors?");
SPI.begin(SCLK, MISO, MOSI); // ePaper Initialisierung SPI, GxEPD library alt, Definition
EPAPER.init(); // ePaper Initialisierung "display" GxEPD alte und GxEPD2 neue library
// ===== WiFi Setup ====== Hotspot Marcel: const char* ssid = "Mi 9 SE"; const char* password = "Schnaegg99";
// Standard WiFi connection code from Wokwi. Note: Specify WiFi channel number (6) when calling WiFi.begin().
// This skips the WiFi scanning phase and saves about 4 seconds when connecting to the WiFi.
Serial.print("Connecting to WiFi... ");
WiFi.begin("Wokwi-GUEST", "", 6); // WiFi.begin("Wokwi-GUEST", ""); Opt. (6) means: skip WiFi scanning phase, save ~4 seconds when connecting
//WiFi.begin("Mi 9 SE", "Schnaegg99", 6); // WiFi.begin for Hotspot Handy Gm
while (WiFi.status() != WL_CONNECTED)
{ delay(100);
Serial.print(".");
//spinner();
}
Serial.print(" Connected to IP address: ... ");
Serial.println(WiFi.localIP());
//OLED.clearBuffer(); // OLED clear buffer for storing display content in RAM
OLED.drawStr(0, 20, "WiFi connected to IP:"); // OLED write some stuff
OLED.setCursor(0, 30);
OLED.print(WiFi.localIP());
OLED.drawStr(50, 30, "Updating time..."); // write some stuff
OLED.sendBuffer(); // send buffer from RAM to display controller
delay(2000);
OLED.clearBuffer(); // clear buffer for storing display content in RAM
LCD.clear(); // LCD clear and write
LCD.setCursor(0, 0);
LCD.println("Online");
LCD.setCursor(0, 1);
LCD.println("Updating time...");
configTime(UTC_OFFSET, UTC_OFFSET_DST, NTP_SERVER);
}
// **************************************************************************************************
// L O O P *
// **************************************************************************************************
void loop()
{
//struct tm timeinfo;
//getLocalTime(&timeinfo);
//Serial.println(&timeinfo, "%H:%M:%S");
printTime_OLED(); // call FUNCTION to write to OLED
//struct tm timeinfo;
//if (!getLocalTime(&timeinfo))
//{ OLED.setCursor(0, 40);
// OLED.print("Connection Err");
// return;
//}
//OLED.setDrawColor(1); // set color to white
//OLED.setFont(u8g2_font_profont10_tr); // font for the small label, e.g. "POWER"
//OLED.setCursor(0, 50);
//OLED.print(&timeinfo, "%H:%M:%S");
//OLED.setCursor(0, 60);
//OLED.print(&timeinfo, "%d/%m/%Y %Z");
//OLED.sendBuffer(); // send buffer from RAM to display controller
printLocalTime(); // call FUNCTION to write to LCD 16x2
EPAPER.setRotation(1); // ePaper test in loop
EPAPER.fillScreen(GxEPD_WHITE);
EPAPER.setTextColor(GxEPD_BLACK);
EPAPER.setFont(&FreeMonoBold9pt7b);
EPAPER.setCursor(10, 30);
EPAPER.println("Hello World");
EPAPER.setFont(&FreeMonoBold12pt7b);
EPAPER.printf("Loop Anzahl %d",cnt);
cnt++;
EPAPER.update();
delay(10000);
delay(250);
}