#include <GxEPD.h>
#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>
// For the NTP access
#include <WiFi.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#define EPD_CS 15
#define EPD_DC 21
#define EPD_RSET 22
#define EPD_BUSY 23
#define EPD_SCLK 4
#define EPD_MISO -1
#define EPD_MOSI 5
GxIO_Class io(SPI, EPD_CS, EPD_DC, EPD_RSET);
GxEPD_Class display(io, EPD_RSET, EPD_BUSY);
// Access
const char* ssid = "Wokwi-GUEST";
const char* password = "";
// Define NTP Server
const char* ntpServerName = "pool.ntp.org";
// Initialize UDP client for NTP
WiFiUDP ntpUDP;
// Define time zone (GMT-3 for Sao Paulo, Brasil)
const long utcOffsetInSeconds = (-3) * 3600;
NTPClient timeClient(ntpUDP, ntpServerName, utcOffsetInSeconds);
void setup()
{
// Init ePaper
SPI.begin(EPD_SCLK, EPD_MISO, EPD_MOSI);
display.init();
display.setRotation(1);
display.fillScreen(GxEPD_WHITE);
display.setTextColor(GxEPD_BLACK);
display.setFont(&FreeMonoBold9pt7b);
display.setCursor(0, 0);
// Init WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(250);
display.print(".");
}
display.println("");
display.println("WiFi connected");
display.println("IP address: ");
display.println(WiFi.localIP());
delay(3000);
display.update();
// Initialize the time client
timeClient.begin();
timeClient.setTimeOffset(utcOffsetInSeconds);
}
void loop() {
// Update the time from the NTP server
timeClient.update();
// Get the current time
uint8_t hours = timeClient.getHours();
uint8_t minutes = timeClient.getMinutes();
uint8_t seconds = timeClient.getSeconds();
// Display the time on the ePaper
display.fillScreen(GxEPD_WHITE);
display.printf("%d : %d", hours, minutes);
display.update();
delay(1000);
}
void Screen1_Bus() {
// Show the time for the next bus
return;
}
void Screen2_Activities() {
// Show the activies by the rommies
return;
}
void Screen3_Weather() {
// Show the weather at now
return;
}
void Screen4_AtHome() {
// Show the rommies at home
return;
}Loading
epaper-2in9
epaper-2in9