losungepaper/losungepaper.ino

54 lines
1.8 KiB
Arduino
Raw Normal View History

2022-08-21 08:48:54 +00:00
#include "epd2in7.h"
#include "epdpaint.h"
// b/w e-Paper
#define COLORED 0
#define UNCOLORED 1
Epd epd;
2022-08-21 19:25:13 +00:00
int DEEP_SLEEP_TIME_uS = 6 * 60 * 60 * 1000 * 1000; // time to deep sleep in microseconds (not milliseconds!)
2022-08-21 08:48:54 +00:00
2022-08-21 15:28:52 +00:00
// WiFi
char wiFiSSID[] = "SSID"; // SSID of your network
char wiFiPSK[] = "PRE-SHARED KEY"; //password of your WPA Network
2022-08-21 17:21:56 +00:00
// NTP (Network Time Protocol)
const String ntpServer = "pool.ntp.org"; // address of ntp server; may also be your router, other local service, etc.
const long gmtOffset_sec = 3600; // for localization (gmt = greenwich mean time); in germany: 3600
const int daylightOffset_sec = 3600; // for daylight saving
2022-08-21 08:48:54 +00:00
// style of the frame shown
2022-08-21 15:04:44 +00:00
sFONT TITLE_FONT = Font20;
2022-08-21 08:48:54 +00:00
char TITLE_TEXT[] = "Losung heute";
2022-08-21 15:04:44 +00:00
sFONT TEXT_FONT = Font12; // for the daily text
int TEXT_WIDTH = 168; // width of the box around the text; should be a multiple of the width of the font (eg. Font8 => multiple of 8)
int TEXT_PADDING_TOP = 40;
int TEXT_PADDING_BETWEEN_BLOCKS = 20; // pixels between the lines
int TEXT_PADDING_BETWEEN_LINES = 1; // pixels between the lines
sFONT SOURCE_FONT = Font8; // for the position in bible
2022-08-21 08:48:54 +00:00
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("[INFO] Initializing e-Paper...");
if (epd.Init() != 0) {
Serial.println("[FATAL] Failed initializing e-Paper; Exiting...");
return;
}
Serial.println("[INFO] Initialized e-Paper!");
2022-08-21 15:04:44 +00:00
connectWiFi();
2022-08-21 17:21:56 +00:00
String html = getHTML();
showDailyText(getLosungFromHTML(html), getLehrtextFromHTML(html), getLosungSourceFromHTML(html), getLehrtextSourceFromHTML(html));
2022-08-21 19:25:13 +00:00
// deep sleep for 6 hours
esp_sleep_enable_timer_wakeup(DEEP_SLEEP_TIME_uS);
Serial.printf("[ESP32] Going to deep sleep mode.\n");
esp_deep_sleep_start();
2022-08-21 08:48:54 +00:00
}
void loop() {
}