m5paper_weather_display.ino
Combines Wi-Fi and e-Ink display to create a simple network clock.
Replace YOUR_SSID and YOUR_PASSWORD with your credentials. Uses the NTPClient library. The screen should not be refreshed too often to avoid 'ghosting' and save battery. Deep sleep mode can be added for maximum autonomy.
m5paper_weather_display.ino
#include <M5EPD.h>
#include <WiFi.h>
#include <WiFiUdp.h>
#include <NTPClient.h>
M5EPD m5epd;
const char *ssid = "YOUR_SSID";
const char *password = "YOUR_PASSWORD";
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "pool.ntp.org", 0, 60000);
void setup() {
m5epd.begin();
m5epd.updateBuffer();
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
m5epd.drawCentreString("Connecting...", 480, 270, 4);
m5epd.updateDisplay();
}
timeClient.begin();
timeClient.forceUpdate();
}
void loop() {
timeClient.update();
m5epd.fillScreen(EPD_WHITE);
m5epd.drawCentreString(timeClient.getFormattedTime(), 480, 270, 8);
m5epd.drawCentreString("M5Paper NTP Clock", 480, 350, 4);
m5epd.updateDisplay();
delay(10000); // Mise à jour toutes les 10 secondes
}