From 78541f164f1d88994265577f4399f5dc3807b1fe Mon Sep 17 00:00:00 2001 From: locker98 Date: Sat, 27 Jul 2024 20:11:27 +0000 Subject: [PATCH] Update ESP32 Code/sound/sound.ino --- ESP32 Code/sound/sound.ino | 1217 ++++++++++++++++++------------------ 1 file changed, 609 insertions(+), 608 deletions(-) diff --git a/ESP32 Code/sound/sound.ino b/ESP32 Code/sound/sound.ino index 9516d68..30ed97a 100755 --- a/ESP32 Code/sound/sound.ino +++ b/ESP32 Code/sound/sound.ino @@ -1,608 +1,609 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - - - -Preferences prefs; -WiFiClient client; -HTTPClient http; - -// Screen configuration -Adafruit_SSD1306 display(128, 32, &Wire, -1); - -AsyncWebServer server(80); -String ssid, pass, ip_address; -bool tone_on = false; -bool gotmessage = false; -bool sermon_over = false; -bool failed = false; -bool cancel = false; -bool connected = false; -unsigned long previousMillis, currentMillis; - -int count; -char ssid_char[20]; -char pass_char[20]; - - -// HTML web page to handle 3 input fields (input1, input2, input3) -const char index_html[] PROGMEM = R"rawliteral( - - - - - ESP Kid's Alarm Sound - - - - - -
- -
-
-

ESP Kid's Alarm Soud

-
- -

Change WIFI Password

-
- SSID: -
- Password: -
- -
- - -
-
-
- -

Set Remote Alarm IP

-
- -
- -
- - - - -
- - - -)rawliteral"; - - - - - - -#define FRAME_COUNT_WIFI (sizeof(frames_wifi) / sizeof(frames_wifi[0])) -const byte PROGMEM frames_wifi[][128] = { - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 3, 224, 38, 56, 30, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 3, 3, 224, 192, 3, 28, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 4, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 3, 224, 38, 56, 30, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 3, 3, 224, 192, 3, 28, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 4, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 3, 224, 38, 56, 30, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 3, 3, 224, 192, 3, 28, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 4, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 3, 224, 38, 56, 30, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 3, 3, 224, 192, 3, 28, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 4, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 15, 240, 38, 56, 112, 14, 28, 16, 192, 3, 8, 3, 0, 0, 192, 3, 15, 240, 64, 1, 48, 12, 128, 0, 224, 7, 0, 0, 1, 193, 0, 0, 14, 240, 0, 0, 24, 24, 0, 0, 8, 16, 0, 0, 4, 32, 0, 0, 2, 96, 0, 0, 1, 192, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 240, 0, 0, 120, 63, 0, 3, 128, 1, 192, 12, 0, 0, 48, 24, 15, 248, 24, 32, 112, 14, 4, 193, 128, 1, 131, 102, 15, 240, 102, 60, 112, 14, 60, 16, 192, 3, 8, 3, 0, 0, 192, 2, 15, 240, 64, 1, 48, 28, 192, 0, 224, 7, 128, 0, 0, 1, 0, 0, 7, 224, 0, 0, 24, 24, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 6, 96, 0, 0, 3, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 252, 0, 0, 224, 15, 0, 7, 0, 0, 224, 12, 0, 0, 48, 48, 31, 248, 8, 96, 224, 7, 6, 195, 0, 1, 195, 102, 3, 224, 102, 56, 62, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 2, 3, 192, 64, 3, 30, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 0, 0, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 8, 48, 0, 0, 4, 96, 0, 0, 2, 64, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 248, 0, 0, 248, 31, 0, 3, 128, 1, 192, 12, 0, 0, 48, 24, 15, 248, 8, 96, 112, 30, 6, 193, 128, 1, 131, 70, 0, 0, 98, 60, 0, 0, 62, 16, 0, 0, 12, 0, 0, 0, 0, 0, 0, 128, 0, 0, 31, 248, 0, 0, 32, 4, 0, 0, 192, 3, 0, 0, 143, 241, 0, 0, 88, 11, 0, 0, 32, 6, 0, 0, 7, 224, 0, 0, 8, 16, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 6, 96, 0, 0, 3, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 248, 0, 0, 224, 7, 0, 1, 0, 128, 128, 6, 30, 120, 96, 12, 96, 6, 48, 5, 128, 1, 32, 3, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 240, 0, 0, 48, 28, 0, 0, 192, 131, 0, 1, 158, 248, 128, 3, 32, 4, 192, 1, 192, 3, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 240, 0, 0, 28, 56, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 6, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 240, 0, 0, 124, 62, 0, 1, 128, 3, 128, 6, 0, 128, 96, 12, 31, 248, 16, 48, 224, 7, 12, 49, 128, 1, 140, 30, 0, 0, 120, 12, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 192, 0, 0, 30, 120, 0, 0, 48, 12, 0, 0, 103, 230, 0, 0, 60, 28, 0, 0, 31, 248, 0, 0, 24, 24, 0, 0, 8, 24, 0, 0, 12, 48, 0, 0, 6, 96, 0, 0, 3, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 248, 0, 0, 248, 31, 0, 3, 128, 1, 192, 12, 0, 0, 48, 24, 15, 248, 8, 96, 112, 30, 6, 193, 128, 1, 131, 70, 0, 0, 98, 60, 0, 0, 62, 16, 0, 0, 12, 0, 7, 240, 0, 0, 60, 60, 0, 0, 224, 6, 0, 1, 128, 1, 128, 1, 15, 240, 128, 0, 176, 13, 0, 0, 96, 7, 0, 0, 0, 0, 0, 0, 7, 224, 0, 0, 8, 16, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 6, 96, 0, 0, 3, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 252, 0, 0, 224, 15, 0, 7, 0, 0, 224, 12, 0, 0, 48, 48, 31, 248, 8, 96, 224, 7, 6, 195, 0, 1, 195, 102, 3, 224, 102, 56, 62, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 2, 3, 192, 64, 3, 30, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 0, 0, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 8, 48, 0, 0, 4, 96, 0, 0, 2, 64, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 240, 0, 0, 120, 63, 0, 3, 128, 1, 192, 12, 0, 0, 48, 24, 15, 248, 24, 32, 112, 14, 4, 193, 128, 1, 131, 102, 15, 240, 102, 60, 112, 14, 60, 16, 192, 3, 8, 3, 0, 0, 192, 2, 15, 240, 64, 1, 48, 28, 192, 0, 224, 7, 128, 0, 0, 1, 0, 0, 7, 224, 0, 0, 24, 24, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 6, 96, 0, 0, 3, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 15, 240, 38, 56, 112, 14, 28, 16, 192, 3, 8, 3, 0, 0, 192, 3, 15, 240, 64, 1, 48, 12, 128, 0, 224, 7, 0, 0, 1, 193, 0, 0, 14, 240, 0, 0, 24, 24, 0, 0, 8, 16, 0, 0, 4, 32, 0, 0, 2, 96, 0, 0, 1, 192, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 3, 224, 38, 56, 30, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 3, 3, 224, 192, 3, 28, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 4, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 3, 224, 38, 56, 30, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 3, 3, 224, 192, 3, 28, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 4, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 3, 224, 38, 56, 30, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 3, 3, 224, 192, 3, 28, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 4, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } -}; - -#define FRAME_COUNT_ALARM (sizeof(frames_alarm) / sizeof(frames_alarm[0])) -const byte PROGMEM frames_alarm[][128] = { - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 32, 12, 0, 0, 16, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 32, 12, 0, 0, 16, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 32, 12, 0, 0, 16, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 32, 12, 0, 0, 16, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 24, 56, 0, 0, 32, 12, 0, 0, 64, 6, 0, 0, 192, 2, 0, 0, 128, 3, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 1, 0, 1, 128, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 128, 3, 0, 0, 128, 2, 0, 0, 128, 6, 0, 0, 192, 12, 0, 0, 96, 8, 0, 0, 32, 8, 0, 0, 48, 14, 0, 0, 32, 3, 248, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 192, 0, 0, 56, 48, 0, 0, 96, 8, 0, 0, 192, 4, 0, 0, 128, 2, 0, 0, 128, 2, 0, 1, 128, 2, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 4, 0, 1, 0, 8, 0, 1, 128, 24, 0, 0, 128, 16, 0, 0, 64, 24, 0, 0, 96, 14, 0, 0, 64, 3, 252, 3, 192, 0, 31, 254, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 15, 192, 0, 0, 48, 48, 0, 0, 96, 24, 0, 0, 128, 12, 0, 0, 128, 4, 0, 1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 6, 0, 2, 0, 4, 0, 2, 0, 12, 0, 2, 0, 24, 0, 2, 0, 48, 0, 3, 0, 32, 0, 1, 0, 32, 0, 1, 128, 24, 0, 0, 128, 15, 0, 0, 128, 1, 252, 1, 128,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0, 2, 0, 6, 0, 2, 0, 4, 0, 2, 0, 4, 0, 2, 0, 8, 0, 2, 0, 24, 0, 2, 0, 32, 0, 2, 0, 96, 0, 3, 0, 32, 0, 1, 0, 24, 0, 0, 128, 15, 0, 0, 128, 1, 252, 1, 128, 0, 31, 254, 0, 0, 16, 96, 0, 0, 24, 64, 0, 0, 8, 192, 0, 0, 7, 128, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 24, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 1, 0, 1, 128, 1, 0, 1, 0, 1, 0, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 6, 0, 0, 64, 12, 0, 0, 96, 8, 0, 0, 48, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 32, 128, 0, 0, 32, 128, 0, 0, 17, 128, 0, 0, 15, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 3, 240, 0, 0, 12, 28, 0, 0, 24, 2, 0, 0, 48, 1, 0, 0, 32, 1, 0, 0, 64, 0, 128, 0, 64, 0, 128, 0, 64, 0, 128, 0, 64, 0, 128, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 96, 0, 64, 0, 32, 0, 64, 0, 48, 0, 64, 0, 16, 0, 192, 0, 12, 0, 128, 0, 4, 1, 128, 0, 4, 3, 0, 0, 8, 3, 0, 0, 112, 1, 128, 31, 128, 0, 127, 240, 0, 0, 64, 128, 0, 0, 33, 128, 0, 0, 51, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 3, 248, 0, 0, 6, 140, 0, 0, 24, 3, 0, 0, 16, 1, 128, 0, 32, 0, 128, 0, 32, 0, 128, 0, 32, 0, 192, 0, 96, 0, 64, 0, 96, 0, 64, 0, 96, 0, 64, 0, 32, 0, 96, 0, 32, 0, 32, 0, 32, 0, 48, 0, 32, 0, 16, 0, 32, 0, 8, 0, 32, 0, 4, 0, 96, 0, 2, 0, 64, 0, 2, 0, 64, 0, 6, 0, 128, 0, 28, 0, 128, 0, 224, 0, 192, 31, 0, 0, 127, 224, 0, 0, 8, 32, 0, 0, 8, 32, 0, 0, 12, 96, 0, 0, 7, 192, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 3, 248, 0, 0, 12, 12, 0, 0, 24, 2, 0, 0, 48, 1, 0, 0, 32, 1, 0, 0, 64, 0, 128, 0, 64, 0, 128, 0, 64, 0, 128, 0, 64, 0, 192, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 32, 0, 64, 0, 32, 0, 64, 0, 48, 0, 64, 0, 24, 0, 64, 0, 12, 0, 128, 0, 6, 1, 128, 0, 4, 1, 0, 0, 8, 1, 0, 0, 112, 1, 128, 31, 128, 0, 127, 243, 0, 0, 0, 131, 0, 0, 0, 194, 0, 0, 0, 102, 0, 0, 0, 56, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 24, 0, 0, 48, 4, 0, 0, 96, 2, 0, 0, 64, 3, 0, 0, 192, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 128, 0, 128, 1, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 1, 128, 0, 192, 1, 0, 0, 64, 3, 0, 0, 32, 2, 0, 0, 48, 4, 0, 0, 16, 4, 0, 0, 16, 6, 0, 0, 48, 3, 224, 15, 192, 0, 127, 248, 64, 0, 0, 16, 64, 0, 0, 16, 192, 0, 0, 15, 128, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 192, 0, 0, 56, 48, 0, 0, 96, 8, 0, 0, 192, 4, 0, 0, 128, 6, 0, 0, 128, 2, 0, 1, 128, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 3, 0, 3, 0, 3, 0, 2, 0, 3, 0, 2, 0, 1, 0, 6, 0, 1, 0, 4, 0, 1, 0, 8, 0, 1, 128, 16, 0, 0, 128, 16, 0, 0, 64, 24, 0, 0, 64, 14, 0, 0, 64, 3, 252, 1, 192, 0, 31, 254, 0, 0, 0, 130, 0, 0, 0, 130, 0, 0, 0, 196, 0, 0, 0, 56, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 15, 192, 0, 0, 48, 48, 0, 0, 96, 24, 0, 0, 128, 12, 0, 0, 128, 4, 0, 1, 128, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 6, 0, 2, 0, 4, 0, 2, 0, 12, 0, 2, 0, 24, 0, 2, 0, 48, 0, 3, 0, 32, 0, 1, 0, 32, 0, 1, 128, 24, 0, 0, 128, 15, 0, 0, 192, 1, 252, 1, 128, 0, 63, 254, 0, 0, 32, 192, 0, 0, 48, 128, 0, 0, 17, 128, 0, 0, 15, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 192, 0, 0, 56, 48, 0, 0, 96, 8, 0, 0, 192, 4, 0, 0, 128, 2, 0, 0, 128, 2, 0, 1, 128, 2, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 3, 0, 3, 0, 2, 0, 3, 0, 2, 0, 1, 0, 6, 0, 1, 0, 4, 0, 1, 0, 8, 0, 1, 128, 16, 0, 0, 128, 16, 0, 0, 64, 24, 0, 0, 64, 14, 0, 0, 64, 3, 252, 1, 192, 1, 159, 254, 0, 1, 6, 0, 0, 0, 132, 0, 0, 0, 236, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 2, 0, 0, 64, 3, 0, 0, 192, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 128, 0, 128, 1, 128, 0, 128, 0, 128, 0, 128, 0, 128, 1, 128, 0, 128, 1, 0, 0, 192, 1, 0, 0, 64, 3, 0, 0, 96, 6, 0, 0, 48, 12, 0, 0, 16, 12, 0, 0, 16, 6, 0, 0, 48, 3, 240, 15, 192, 0, 127, 248, 0, 0, 32, 128, 0, 0, 33, 128, 0, 0, 49, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 240, 0, 0, 12, 28, 0, 0, 16, 6, 0, 0, 32, 3, 0, 0, 64, 1, 0, 0, 64, 1, 0, 0, 64, 1, 128, 0, 64, 0, 128, 0, 192, 0, 128, 0, 192, 0, 128, 0, 192, 0, 128, 0, 192, 0, 128, 0, 192, 0, 64, 0, 128, 0, 64, 0, 128, 0, 96, 0, 128, 0, 32, 1, 128, 0, 16, 1, 0, 0, 8, 2, 0, 0, 8, 6, 0, 0, 24, 2, 0, 0, 112, 1, 192, 31, 128, 0, 127, 252, 0, 0, 2, 8, 0, 0, 2, 8, 0, 0, 3, 24, 0, 0, 0, 240, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 12, 24, 0, 0, 48, 4, 0, 0, 32, 2, 0, 0, 64, 3, 0, 0, 64, 1, 0, 0, 192, 1, 0, 0, 128, 1, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 192, 0, 128, 0, 64, 1, 128, 0, 96, 1, 0, 0, 32, 3, 0, 0, 16, 6, 0, 0, 8, 4, 0, 0, 24, 6, 0, 0, 48, 3, 224, 31, 192, 0, 127, 251, 0, 0, 0, 130, 0, 0, 0, 194, 0, 0, 0, 102, 0, 0, 0, 56, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 24, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 1, 0, 1, 128, 1, 0, 1, 0, 1, 0, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 96, 8, 0, 0, 48, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 1, 4, 0, 0, 1, 4, 0, 0, 1, 136, 0, 0, 0, 112, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 192, 0, 0, 24, 56, 0, 0, 32, 12, 0, 0, 64, 4, 0, 0, 128, 2, 0, 0, 128, 2, 0, 0, 128, 3, 0, 1, 128, 1, 0, 1, 128, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 0, 1, 128, 2, 0, 0, 128, 4, 0, 0, 128, 12, 0, 0, 64, 24, 0, 0, 32, 8, 0, 0, 32, 14, 0, 0, 96, 3, 248, 3, 192, 0, 31, 252, 0, 0, 8, 32, 0, 0, 8, 32, 0, 0, 4, 96, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 24, 56, 0, 0, 32, 12, 0, 0, 64, 6, 0, 0, 192, 2, 0, 0, 128, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 1, 0, 1, 128, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 3, 0, 0, 128, 2, 0, 0, 128, 6, 0, 0, 192, 12, 0, 0, 64, 24, 0, 0, 32, 8, 0, 0, 48, 14, 0, 0, 96, 3, 248, 7, 192, 0, 63, 252, 0, 0, 16, 64, 0, 0, 16, 64, 0, 0, 24, 128, 0, 0, 15, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 24, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 1, 0, 1, 128, 1, 0, 1, 0, 1, 0, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 6, 0, 0, 64, 12, 0, 0, 96, 8, 0, 0, 48, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 24, 32, 0, 0, 8, 96, 0, 0, 12, 64, 0, 0, 7, 128, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 32, 12, 0, 0, 16, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 32, 12, 0, 0, 16, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 32, 12, 0, 0, 16, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 } -}; - - - - - -void displaytask(void *prameters) { - int frame; - int old_count; - - //Start Screen - if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { - Serial.println("SSD1306 allocation failed"); - for (;;) - ; // Don't proceed, loop forever - } - display.display(); - display.clearDisplay(); - old_count = count; - while (true) { - display.fillRect(0, 0, 32, 32, 0); - display.drawFastVLine(36, 0, 32, 255); - - - if (failed) { - display.clearDisplay(); - display.setTextSize(1); // Normal 1:1 pixel scale - display.setCursor(42, 1); // Start at top-left corner - display.print("FAILED"); - display.display(); - vTaskDelay(2000 / portTICK_PERIOD_MS); - failed = false; - - } else if (!connected) { - display.fillRect(37, 0, 128, 32, 0); - display.setTextColor(SSD1306_WHITE); // Draw white text - - if (WiFi.status() != WL_CONNECTED) { - display.setTextSize(1); // Normal 1:1 pixel scale - display.setCursor(42, 1); // Start at top-left corner - display.print("Connect"); - display.setCursor(42, 10); // Start at top-left corner - display.print("Phone"); - - } else { - display.setTextSize(1); // Normal 1:1 pixel scale - - display.setCursor(42, 15); // Start at top-left corner - display.print(WiFi.localIP()); - } - - for (int i = 0; i < FRAME_COUNT_WIFI; i++) { - display.fillRect(0, 0, 35, 32, 0); - display.drawBitmap(0, 0, frames_wifi[i], 32, 32, 1); - display.display(); - vTaskDelay(42 / portTICK_PERIOD_MS); - } - - - } else if (tone_on) { - display.fillRect(37, 0, 128, 32, 0); - display.setTextColor(SSD1306_WHITE); // Draw white text - display.setTextSize(1); // Normal 1:1 pixel scale - display.setCursor(42, 2); // Start at top-left corner - display.print("Alarm"); - display.setCursor(42, 15); // Start at top-left corner - display.print("Sent"); - - - for (int i = 0; i < FRAME_COUNT_ALARM; i++) { - display.fillRect(0, 0, 35, 32, 0); - display.drawBitmap(0, 0, frames_alarm[i], 32, 32, 1); - display.display(); - vTaskDelay(21 / portTICK_PERIOD_MS); - } - tone_on = false; - - } else if (gotmessage) { - - display.fillRect(37, 0, 128, 32, 0); - display.setTextColor(SSD1306_WHITE); // Draw white text - display.setTextSize(1); // Normal 1:1 pixel scale - display.setCursor(42, 2); // Start at top-left corner - display.print("They are"); - display.setCursor(42, 15); // Start at top-left corner - display.print("Comming Back"); - gotmessage = false; - tone_on = false; - - } else if (cancel) { - - display.fillRect(37, 0, 128, 32, 0); - display.setTextColor(SSD1306_WHITE); // Draw white text - display.setTextSize(1); // Normal 1:1 pixel scale - display.setCursor(42, 2); // Start at top-left corner - display.print("Canceled"); - - cancel = false; - - } else if (sermon_over) { - display.fillRect(37, 0, 128, 32, 0); - display.setTextColor(SSD1306_WHITE); // Draw white text - display.setTextSize(1); // Normal 1:1 pixel scale - display.setCursor(42, 1); // Start at top-left corner - display.print("Sermon Over"); - display.setCursor(42, 12); // Start at top-left corner - display.print("Worship"); - display.setCursor(42, 24); // Start at top-left corner - display.print("Started"); - - sermon_over = false; - - } else if (count != old_count) { - display.fillRect(37, 0, 128, 32, 0); - display.setTextSize(2); // Normal 1:1 pixel scale - - if (count == -2) { - - display.setTextSize(2); // Normal 1:1 pixel scale - display.setCursor(55, 0); // Start at top-left corner - display.print("OK"); - display.setCursor(55, 17); // Start at top-left corner - display.print(old_count); - - - count = 0; - } else { - display.setCursor(55, 0); // Start at top-left corner - display.print("Count"); - display.setCursor(70, 17); // Start at top-left corner - display.print(count); - } - old_count = count; - - display.fillRect(0, 0, 35, 32, 0); - display.drawBitmap(0, 0, frames_wifi[23], 32, 32, 1); - - } else { - display.fillRect(0, 0, 35, 32, 0); - display.drawBitmap(0, 0, frames_wifi[23], 32, 32, 1); - } - - display.display(); - vTaskDelay(50 / portTICK_PERIOD_MS); - } -} - - - - - - - - - - -#define BUTTON1 33 -#define BUTTON2 32 -#define BUTTON3 5 -#define BUTTON4 0 - - - - -void setup() { - - Serial.begin(9600); - - xTaskCreate( - displaytask, // Funcction name - "Task for Display", // Task Name - 4000, // stack size - NULL, // task parameters - 1, // task priority - NULL // task handel - ); - - - //buttons - pinMode(BUTTON1, INPUT_PULLUP); - pinMode(BUTTON2, INPUT_PULLUP); - pinMode(BUTTON3, INPUT_PULLUP); - pinMode(BUTTON4, INPUT_PULLUP); - - - - - prefs.begin("kam_alarm"); - - ip_address = prefs.getString("IPADDRESS"); - - WiFi.mode(WIFI_STA); - WiFi.disconnect(); - delay(100); - ssid = prefs.getString("SSID"); - pass = prefs.getString("PASS"); - ssid.toCharArray(ssid_char, 20); - pass.toCharArray(pass_char, 20); - WiFi.begin(ssid_char, pass_char); - - // Allow Time for Wifi Connection 10 seconds - delay(10000); - - // Check if connected to wifi - if (WiFi.status() != WL_CONNECTED) { - WiFi.mode(WIFI_MODE_AP); - WiFi.softAP("KamAlarm", "KAMisFun!"); - WiFi.softAPIP(); - } - - // Send web page with input fields to client - server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { - if (!request->authenticate("admin", "KAM_alarm")) - return request->requestAuthentication(); - - if (request->hasParam("pass") && request->hasParam("ssid")) { - request->send_P(200, "text/html", index_html); - ssid = request->getParam("ssid")->value(); - pass = request->getParam("pass")->value(); - - Serial.print("New Password is:\t"); - Serial.println(pass); - Serial.print("New SSID is:\t"); - Serial.println(ssid); - - prefs.putString("SSID", ssid); - prefs.putString("PASS", pass); - Serial.println("Done"); - } else if (request->hasParam("data")) { - ssid = prefs.getString("SSID"); - pass = prefs.getString("PASS"); - request->send(200, "text/html", "ESP Kid's Alarm

Current WIFI Settings



SSID: \"" + ssid + "\"
Password: \"" + pass + "\"



"); - } else if (request->hasParam("logout")) { - request->send(401, "text/html", "ESP Kid's Alarm

Success





"); - } else if (request->hasParam("ipaddress")) { - request->send_P(200, "text/html", index_html); - ip_address = request->getParam("ipaddress")->value(); - prefs.putString("IPADDRESS", ip_address); - - } else if (request->hasParam("ipget")) { - ip_address = prefs.getString("IPADDRESS"); - request->send(200, "text/html", "ESP Kid's Alarm

Current IP Settings


Remote IP Address: \"" + ip_address + "\"



"); - - - } else if (request->hasParam("count")) { - request->send_P(200, "text/html", index_html); - count = request->getParam("count")->value().toInt(); - - } else if (request->hasParam("got_message")) { - request->send_P(200, "text/html", ""); - gotmessage = true; - - } else { - request->send_P(200, "text/html", index_html); - } - }); - - // Start Server - server.begin(); -} - - - -void loop() { - getconnection(); - - - if (!digitalRead(BUTTON1) && !tone_on) { - - int httpResponseCode = GETRequest("http://admin:KAM_alarm@" + ip_address + "/?comeback=1"); - - Serial.println(httpResponseCode); - if (httpResponseCode != 200) { - failed = true; - } else { - tone_on = true; - } - - while (!digitalRead(BUTTON1)) - ; - } - - if (!digitalRead(BUTTON2)) { - - int httpResponseCode = GETRequest("http://admin:KAM_alarm@" + ip_address + "/?cancel=1"); - - Serial.println(httpResponseCode); - - cancel = true; - - if (httpResponseCode != 200) { - failed = true; - } else { - cancel = true; - } - - while (!digitalRead(BUTTON2)) - ; - } - - if (!digitalRead(BUTTON3)) { - - int httpResponseCode = GETRequest("http://admin:KAM_alarm@" + ip_address + "/?sermonover=1"); - - Serial.println(httpResponseCode); - - if (httpResponseCode != 200) { - failed = true; - } else { - sermon_over = true; - } - - while (!digitalRead(BUTTON3)) - ; - } - - - if (!digitalRead(BUTTON4) && count > 0) { - - - int httpResponseCode = GETRequest("http://admin:KAM_alarm@" + ip_address + "/?receivedcount=1"); - - count = -2; - - - while (!digitalRead(BUTTON4)) - ; - } -} - - - -void getconnection() { - currentMillis = millis(); - if (currentMillis - previousMillis > 10000) { - - int response = GETRequest("http://admin:KAM_alarm@" + ip_address); - - if (response == 200) { - connected = true; - Serial.println("Connected"); - } else { - connected = false; - Serial.println("Not Connected"); - } - previousMillis = currentMillis; - } -} - - - -int GETRequest(String URL) { - int response; - - HTTPClient http; - - http.begin(URL.c_str()); - http.addHeader("Content-Type", "application/x-www-form-urlencoded"); - http.setTimeout(5000); - response = http.GET(); - http.end(); - - Serial.println(URL); - - return response; -} - - -int POSTRequest(String URL) { - int response; - - HTTPClient http; - - http.begin(URL.c_str()); - http.addHeader("Content-Type", "application/x-www-form-urlencoded"); - http.setTimeout(5000); - response = http.POST(""); - http.end(); - - Serial.println(URL); - - return response; -} +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + + + +Preferences prefs; +WiFiClient client; +HTTPClient http; + +// Screen configuration +Adafruit_SSD1306 display(128, 32, &Wire, -1); + +AsyncWebServer server(80); +String ssid, pass, ip_address; +bool tone_on = false; +bool gotmessage = false; +bool sermon_over = false; +bool failed = false; +bool cancel = false; +bool connected = false; +unsigned long previousMillis, currentMillis; + +int count; +char ssid_char[20]; +char pass_char[20]; + + +// HTML web page to handle 3 input fields (input1, input2, input3) +const char index_html[] PROGMEM = R"rawliteral( + + + + + ESP Kid's Alarm Sound + + + + + +
+ +
+
+

ESP Kid's Alarm Soud

+
+ +

Change WIFI Password

+
+ SSID: +
+ Password: +
+ +
+ + +
+
+
+ +

Set Remote Alarm IP

+
+ +
+ +
+ + + + +
+ + + +)rawliteral"; + + + +// Wokwi Animator +// https://animator.wokwi.com + + +#define FRAME_COUNT_WIFI (sizeof(frames_wifi) / sizeof(frames_wifi[0])) +const byte PROGMEM frames_wifi[][128] = { + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 3, 224, 38, 56, 30, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 3, 3, 224, 192, 3, 28, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 4, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 3, 224, 38, 56, 30, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 3, 3, 224, 192, 3, 28, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 4, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 3, 224, 38, 56, 30, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 3, 3, 224, 192, 3, 28, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 4, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 3, 224, 38, 56, 30, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 3, 3, 224, 192, 3, 28, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 4, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 15, 240, 38, 56, 112, 14, 28, 16, 192, 3, 8, 3, 0, 0, 192, 3, 15, 240, 64, 1, 48, 12, 128, 0, 224, 7, 0, 0, 1, 193, 0, 0, 14, 240, 0, 0, 24, 24, 0, 0, 8, 16, 0, 0, 4, 32, 0, 0, 2, 96, 0, 0, 1, 192, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 240, 0, 0, 120, 63, 0, 3, 128, 1, 192, 12, 0, 0, 48, 24, 15, 248, 24, 32, 112, 14, 4, 193, 128, 1, 131, 102, 15, 240, 102, 60, 112, 14, 60, 16, 192, 3, 8, 3, 0, 0, 192, 2, 15, 240, 64, 1, 48, 28, 192, 0, 224, 7, 128, 0, 0, 1, 0, 0, 7, 224, 0, 0, 24, 24, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 6, 96, 0, 0, 3, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 252, 0, 0, 224, 15, 0, 7, 0, 0, 224, 12, 0, 0, 48, 48, 31, 248, 8, 96, 224, 7, 6, 195, 0, 1, 195, 102, 3, 224, 102, 56, 62, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 2, 3, 192, 64, 3, 30, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 0, 0, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 8, 48, 0, 0, 4, 96, 0, 0, 2, 64, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 248, 0, 0, 248, 31, 0, 3, 128, 1, 192, 12, 0, 0, 48, 24, 15, 248, 8, 96, 112, 30, 6, 193, 128, 1, 131, 70, 0, 0, 98, 60, 0, 0, 62, 16, 0, 0, 12, 0, 0, 0, 0, 0, 0, 128, 0, 0, 31, 248, 0, 0, 32, 4, 0, 0, 192, 3, 0, 0, 143, 241, 0, 0, 88, 11, 0, 0, 32, 6, 0, 0, 7, 224, 0, 0, 8, 16, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 6, 96, 0, 0, 3, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 248, 0, 0, 224, 7, 0, 1, 0, 128, 128, 6, 30, 120, 96, 12, 96, 6, 48, 5, 128, 1, 32, 3, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 192, 0, 0, 15, 48, 0, 0, 31, 248, 0, 0, 24, 24, 0, 0, 8, 24, 0, 0, 12, 48, 0, 0, 6, 96, 0, 0, 3, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 12, 48, 0, 0, 6, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 240, 0, 0, 124, 62, 0, 1, 128, 3, 128, 6, 0, 128, 96, 12, 31, 248, 16, 48, 224, 7, 12, 49, 128, 1, 140, 30, 0, 0, 120, 12, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 192, 0, 0, 30, 120, 0, 0, 48, 12, 0, 0, 103, 230, 0, 0, 60, 28, 0, 0, 31, 248, 0, 0, 24, 24, 0, 0, 8, 24, 0, 0, 12, 48, 0, 0, 6, 96, 0, 0, 3, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 248, 0, 0, 248, 31, 0, 3, 128, 1, 192, 12, 0, 0, 48, 24, 15, 248, 8, 96, 112, 30, 6, 193, 128, 1, 131, 70, 0, 0, 98, 60, 0, 0, 62, 16, 0, 0, 12, 0, 7, 240, 0, 0, 60, 60, 0, 0, 224, 6, 0, 1, 128, 1, 128, 1, 15, 240, 128, 0, 176, 13, 0, 0, 96, 7, 0, 0, 0, 0, 0, 0, 7, 224, 0, 0, 8, 16, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 6, 96, 0, 0, 3, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 252, 0, 0, 224, 15, 0, 7, 0, 0, 224, 12, 0, 0, 48, 48, 31, 248, 8, 96, 224, 7, 6, 195, 0, 1, 195, 102, 3, 224, 102, 56, 62, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 2, 3, 192, 64, 3, 30, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 0, 0, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 8, 48, 0, 0, 4, 96, 0, 0, 2, 64, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 240, 0, 0, 120, 63, 0, 3, 128, 1, 192, 12, 0, 0, 48, 24, 15, 248, 24, 32, 112, 14, 4, 193, 128, 1, 131, 102, 15, 240, 102, 60, 112, 14, 60, 16, 192, 3, 8, 3, 0, 0, 192, 2, 15, 240, 64, 1, 48, 28, 192, 0, 224, 7, 128, 0, 0, 1, 0, 0, 7, 224, 0, 0, 24, 24, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 6, 96, 0, 0, 3, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 15, 240, 38, 56, 112, 14, 28, 16, 192, 3, 8, 3, 0, 0, 192, 3, 15, 240, 64, 1, 48, 12, 128, 0, 224, 7, 0, 0, 1, 193, 0, 0, 14, 240, 0, 0, 24, 24, 0, 0, 8, 16, 0, 0, 4, 32, 0, 0, 2, 96, 0, 0, 1, 192, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 3, 224, 38, 56, 30, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 3, 3, 224, 192, 3, 28, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 4, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 3, 224, 38, 56, 30, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 3, 3, 224, 192, 3, 28, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 4, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 252, 0, 0, 192, 3, 128, 7, 0, 0, 224, 12, 0, 128, 16, 48, 63, 252, 12, 96, 192, 3, 6, 67, 0, 0, 195, 38, 3, 224, 38, 56, 30, 124, 28, 16, 224, 7, 8, 1, 128, 1, 128, 3, 3, 224, 192, 3, 28, 120, 192, 1, 160, 5, 128, 0, 192, 3, 0, 0, 3, 224, 0, 0, 12, 48, 0, 0, 24, 24, 0, 0, 12, 48, 0, 0, 4, 96, 0, 0, 2, 192, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; + +#define FRAME_COUNT_ALARM (sizeof(frames_alarm) / sizeof(frames_alarm[0])) +const byte PROGMEM frames_alarm[][128] = { + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 32, 12, 0, 0, 16, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 32, 12, 0, 0, 16, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 32, 12, 0, 0, 16, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 32, 12, 0, 0, 16, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 24, 56, 0, 0, 32, 12, 0, 0, 64, 6, 0, 0, 192, 2, 0, 0, 128, 3, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 1, 0, 1, 128, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 128, 3, 0, 0, 128, 2, 0, 0, 128, 6, 0, 0, 192, 12, 0, 0, 96, 8, 0, 0, 32, 8, 0, 0, 48, 14, 0, 0, 32, 3, 248, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 192, 0, 0, 56, 48, 0, 0, 96, 8, 0, 0, 192, 4, 0, 0, 128, 2, 0, 0, 128, 2, 0, 1, 128, 2, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 4, 0, 1, 0, 8, 0, 1, 128, 24, 0, 0, 128, 16, 0, 0, 64, 24, 0, 0, 96, 14, 0, 0, 64, 3, 252, 3, 192, 0, 31, 254, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 15, 192, 0, 0, 48, 48, 0, 0, 96, 24, 0, 0, 128, 12, 0, 0, 128, 4, 0, 1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 6, 0, 2, 0, 4, 0, 2, 0, 12, 0, 2, 0, 24, 0, 2, 0, 48, 0, 3, 0, 32, 0, 1, 0, 32, 0, 1, 128, 24, 0, 0, 128, 15, 0, 0, 128, 1, 252, 1, 128, 0, 15, 254, 0, 0, 8, 48, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 31, 192, 0, 0, 96, 96, 0, 0, 192, 24, 0, 0, 128, 8, 0, 1, 0, 4, 0, 1, 0, 4, 0, 3, 0, 4, 0, 2, 0, 6, 0, 2, 0,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0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 24, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 1, 0, 1, 128, 1, 0, 1, 0, 1, 0, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 6, 0, 0, 64, 12, 0, 0, 96, 8, 0, 0, 48, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 32, 128, 0, 0, 32, 128, 0, 0, 17, 128, 0, 0, 15, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 3, 240, 0, 0, 12, 28, 0, 0, 24, 2, 0, 0, 48, 1, 0, 0, 32, 1, 0, 0, 64, 0, 128, 0, 64, 0, 128, 0, 64, 0, 128, 0, 64, 0, 128, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 96, 0, 64, 0, 32, 0, 64, 0, 48, 0, 64, 0, 16, 0, 192, 0, 12, 0, 128, 0, 4, 1, 128, 0, 4, 3, 0, 0, 8, 3, 0, 0, 112, 1, 128, 31, 128, 0, 127, 240, 0, 0, 64, 128, 0, 0, 33, 128, 0, 0, 51, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 3, 248, 0, 0, 6, 140, 0, 0, 24, 3, 0, 0, 16, 1, 128, 0, 32, 0, 128, 0, 32, 0, 128, 0, 32, 0, 192, 0, 96, 0, 64, 0, 96, 0, 64, 0, 96, 0, 64, 0, 32, 0, 96, 0, 32, 0, 32, 0, 32, 0, 48, 0, 32, 0, 16, 0, 32, 0, 8, 0, 32, 0, 4, 0, 96, 0, 2, 0, 64, 0, 2, 0, 64, 0, 6, 0, 128, 0, 28, 0, 128, 0, 224, 0, 192, 31, 0, 0, 127, 224, 0, 0, 8, 32, 0, 0, 8, 32, 0, 0, 12, 96, 0, 0, 7, 192, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 3, 248, 0, 0, 12, 12, 0, 0, 24, 2, 0, 0, 48, 1, 0, 0, 32, 1, 0, 0, 64, 0, 128, 0, 64, 0, 128, 0, 64, 0, 128, 0, 64, 0, 192, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 32, 0, 64, 0, 32, 0, 64, 0, 48, 0, 64, 0, 24, 0, 64, 0, 12, 0, 128, 0, 6, 1, 128, 0, 4, 1, 0, 0, 8, 1, 0, 0, 112, 1, 128, 31, 128, 0, 127, 243, 0, 0, 0, 131, 0, 0, 0, 194, 0, 0, 0, 102, 0, 0, 0, 56, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 24, 0, 0, 48, 4, 0, 0, 96, 2, 0, 0, 64, 3, 0, 0, 192, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 128, 0, 128, 1, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 1, 128, 0, 192, 1, 0, 0, 64, 3, 0, 0, 32, 2, 0, 0, 48, 4, 0, 0, 16, 4, 0, 0, 16, 6, 0, 0, 48, 3, 224, 15, 192, 0, 127, 248, 64, 0, 0, 16, 64, 0, 0, 16, 192, 0, 0, 15, 128, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 192, 0, 0, 56, 48, 0, 0, 96, 8, 0, 0, 192, 4, 0, 0, 128, 6, 0, 0, 128, 2, 0, 1, 128, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 3, 0, 3, 0, 3, 0, 2, 0, 3, 0, 2, 0, 1, 0, 6, 0, 1, 0, 4, 0, 1, 0, 8, 0, 1, 128, 16, 0, 0, 128, 16, 0, 0, 64, 24, 0, 0, 64, 14, 0, 0, 64, 3, 252, 1, 192, 0, 31, 254, 0, 0, 0, 130, 0, 0, 0, 130, 0, 0, 0, 196, 0, 0, 0, 56, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 15, 192, 0, 0, 48, 48, 0, 0, 96, 24, 0, 0, 128, 12, 0, 0, 128, 4, 0, 1, 128, 2, 0, 1, 0, 2, 0, 1, 0, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 6, 0, 2, 0, 4, 0, 2, 0, 12, 0, 2, 0, 24, 0, 2, 0, 48, 0, 3, 0, 32, 0, 1, 0, 32, 0, 1, 128, 24, 0, 0, 128, 15, 0, 0, 192, 1, 252, 1, 128, 0, 63, 254, 0, 0, 32, 192, 0, 0, 48, 128, 0, 0, 17, 128, 0, 0, 15, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 192, 0, 0, 56, 48, 0, 0, 96, 8, 0, 0, 192, 4, 0, 0, 128, 2, 0, 0, 128, 2, 0, 1, 128, 2, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 3, 0, 3, 0, 3, 0, 2, 0, 3, 0, 2, 0, 1, 0, 6, 0, 1, 0, 4, 0, 1, 0, 8, 0, 1, 128, 16, 0, 0, 128, 16, 0, 0, 64, 24, 0, 0, 64, 14, 0, 0, 64, 3, 252, 1, 192, 1, 159, 254, 0, 1, 6, 0, 0, 0, 132, 0, 0, 0, 236, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 2, 0, 0, 64, 3, 0, 0, 192, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 128, 0, 128, 1, 128, 0, 128, 0, 128, 0, 128, 0, 128, 1, 128, 0, 128, 1, 0, 0, 192, 1, 0, 0, 64, 3, 0, 0, 96, 6, 0, 0, 48, 12, 0, 0, 16, 12, 0, 0, 16, 6, 0, 0, 48, 3, 240, 15, 192, 0, 127, 248, 0, 0, 32, 128, 0, 0, 33, 128, 0, 0, 49, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 240, 0, 0, 12, 28, 0, 0, 16, 6, 0, 0, 32, 3, 0, 0, 64, 1, 0, 0, 64, 1, 0, 0, 64, 1, 128, 0, 64, 0, 128, 0, 192, 0, 128, 0, 192, 0, 128, 0, 192, 0, 128, 0, 192, 0, 128, 0, 192, 0, 64, 0, 128, 0, 64, 0, 128, 0, 96, 0, 128, 0, 32, 1, 128, 0, 16, 1, 0, 0, 8, 2, 0, 0, 8, 6, 0, 0, 24, 2, 0, 0, 112, 1, 192, 31, 128, 0, 127, 252, 0, 0, 2, 8, 0, 0, 2, 8, 0, 0, 3, 24, 0, 0, 0, 240, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 12, 24, 0, 0, 48, 4, 0, 0, 32, 2, 0, 0, 64, 3, 0, 0, 64, 1, 0, 0, 192, 1, 0, 0, 128, 1, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 192, 0, 128, 0, 64, 1, 128, 0, 96, 1, 0, 0, 32, 3, 0, 0, 16, 6, 0, 0, 8, 4, 0, 0, 24, 6, 0, 0, 48, 3, 224, 31, 192, 0, 127, 251, 0, 0, 0, 130, 0, 0, 0, 194, 0, 0, 0, 102, 0, 0, 0, 56, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 24, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 1, 0, 1, 128, 1, 0, 1, 0, 1, 0, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 96, 8, 0, 0, 48, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 1, 4, 0, 0, 1, 4, 0, 0, 1, 136, 0, 0, 0, 112, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 192, 0, 0, 24, 56, 0, 0, 32, 12, 0, 0, 64, 4, 0, 0, 128, 2, 0, 0, 128, 2, 0, 0, 128, 3, 0, 1, 128, 1, 0, 1, 128, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 0, 1, 128, 2, 0, 0, 128, 4, 0, 0, 128, 12, 0, 0, 64, 24, 0, 0, 32, 8, 0, 0, 32, 14, 0, 0, 96, 3, 248, 3, 192, 0, 31, 252, 0, 0, 8, 32, 0, 0, 8, 32, 0, 0, 4, 96, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 24, 56, 0, 0, 32, 12, 0, 0, 64, 6, 0, 0, 192, 2, 0, 0, 128, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 1, 0, 1, 128, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 3, 0, 0, 128, 2, 0, 0, 128, 6, 0, 0, 192, 12, 0, 0, 64, 24, 0, 0, 32, 8, 0, 0, 48, 14, 0, 0, 96, 3, 248, 7, 192, 0, 63, 252, 0, 0, 16, 64, 0, 0, 16, 64, 0, 0, 24, 128, 0, 0, 15, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 24, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 1, 0, 1, 128, 1, 0, 1, 0, 1, 0, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 6, 0, 0, 64, 12, 0, 0, 96, 8, 0, 0, 48, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 24, 32, 0, 0, 8, 96, 0, 0, 12, 64, 0, 0, 7, 128, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 32, 12, 0, 0, 16, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 32, 12, 0, 0, 16, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 3, 192, 0, 0, 2, 64, 0, 0, 2, 64, 0, 0, 7, 224, 0, 0, 28, 56, 0, 0, 48, 4, 0, 0, 96, 6, 0, 0, 192, 2, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 1, 0, 1, 128, 0, 128, 1, 0, 0, 128, 1, 0, 0, 128, 3, 0, 0, 192, 2, 0, 0, 64, 4, 0, 0, 32, 12, 0, 0, 16, 8, 0, 0, 16, 6, 0, 0, 32, 3, 240, 7, 192, 0, 63, 252, 0, 0, 8, 16, 0, 0, 4, 48, 0, 0, 4, 32, 0, 0, 3, 192, 0, 0, 0, 0, 0 } +}; + + + + + +void displaytask(void *prameters) { + int frame; + int old_count; + + //Start Screen + if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { + Serial.println("SSD1306 allocation failed"); + for (;;) + ; // Don't proceed, loop forever + } + display.display(); + display.clearDisplay(); + old_count = count; + while (true) { + display.fillRect(0, 0, 32, 32, 0); + display.drawFastVLine(36, 0, 32, 255); + + + if (failed) { + display.clearDisplay(); + display.setTextSize(1); // Normal 1:1 pixel scale + display.setCursor(42, 1); // Start at top-left corner + display.print("FAILED"); + display.display(); + vTaskDelay(2000 / portTICK_PERIOD_MS); + failed = false; + + } else if (!connected) { + display.fillRect(37, 0, 128, 32, 0); + display.setTextColor(SSD1306_WHITE); // Draw white text + + if (WiFi.status() != WL_CONNECTED) { + display.setTextSize(1); // Normal 1:1 pixel scale + display.setCursor(42, 1); // Start at top-left corner + display.print("Connect"); + display.setCursor(42, 10); // Start at top-left corner + display.print("Phone"); + + } else { + display.setTextSize(1); // Normal 1:1 pixel scale + + display.setCursor(42, 15); // Start at top-left corner + display.print(WiFi.localIP()); + } + + for (int i = 0; i < FRAME_COUNT_WIFI; i++) { + display.fillRect(0, 0, 35, 32, 0); + display.drawBitmap(0, 0, frames_wifi[i], 32, 32, 1); + display.display(); + vTaskDelay(42 / portTICK_PERIOD_MS); + } + + + } else if (tone_on) { + display.fillRect(37, 0, 128, 32, 0); + display.setTextColor(SSD1306_WHITE); // Draw white text + display.setTextSize(1); // Normal 1:1 pixel scale + display.setCursor(42, 2); // Start at top-left corner + display.print("Alarm"); + display.setCursor(42, 15); // Start at top-left corner + display.print("Sent"); + + + for (int i = 0; i < FRAME_COUNT_ALARM; i++) { + display.fillRect(0, 0, 35, 32, 0); + display.drawBitmap(0, 0, frames_alarm[i], 32, 32, 1); + display.display(); + vTaskDelay(21 / portTICK_PERIOD_MS); + } + tone_on = false; + + } else if (gotmessage) { + + display.fillRect(37, 0, 128, 32, 0); + display.setTextColor(SSD1306_WHITE); // Draw white text + display.setTextSize(1); // Normal 1:1 pixel scale + display.setCursor(42, 2); // Start at top-left corner + display.print("They are"); + display.setCursor(42, 15); // Start at top-left corner + display.print("Comming Back"); + gotmessage = false; + tone_on = false; + + } else if (cancel) { + + display.fillRect(37, 0, 128, 32, 0); + display.setTextColor(SSD1306_WHITE); // Draw white text + display.setTextSize(1); // Normal 1:1 pixel scale + display.setCursor(42, 2); // Start at top-left corner + display.print("Canceled"); + + cancel = false; + + } else if (sermon_over) { + display.fillRect(37, 0, 128, 32, 0); + display.setTextColor(SSD1306_WHITE); // Draw white text + display.setTextSize(1); // Normal 1:1 pixel scale + display.setCursor(42, 1); // Start at top-left corner + display.print("Sermon Over"); + display.setCursor(42, 12); // Start at top-left corner + display.print("Worship"); + display.setCursor(42, 24); // Start at top-left corner + display.print("Started"); + + sermon_over = false; + + } else if (count != old_count) { + display.fillRect(37, 0, 128, 32, 0); + display.setTextSize(2); // Normal 1:1 pixel scale + + if (count == -2) { + + display.setTextSize(2); // Normal 1:1 pixel scale + display.setCursor(55, 0); // Start at top-left corner + display.print("OK"); + display.setCursor(55, 17); // Start at top-left corner + display.print(old_count); + + + count = 0; + } else { + display.setCursor(55, 0); // Start at top-left corner + display.print("Count"); + display.setCursor(70, 17); // Start at top-left corner + display.print(count); + } + old_count = count; + + display.fillRect(0, 0, 35, 32, 0); + display.drawBitmap(0, 0, frames_wifi[23], 32, 32, 1); + + } else { + display.fillRect(0, 0, 35, 32, 0); + display.drawBitmap(0, 0, frames_wifi[23], 32, 32, 1); + } + + display.display(); + vTaskDelay(50 / portTICK_PERIOD_MS); + } +} + + + + + + + + + + +#define BUTTON1 33 +#define BUTTON2 32 +#define BUTTON3 5 +#define BUTTON4 0 + + + + +void setup() { + + Serial.begin(9600); + + xTaskCreate( + displaytask, // Funcction name + "Task for Display", // Task Name + 4000, // stack size + NULL, // task parameters + 1, // task priority + NULL // task handel + ); + + + //buttons + pinMode(BUTTON1, INPUT_PULLUP); + pinMode(BUTTON2, INPUT_PULLUP); + pinMode(BUTTON3, INPUT_PULLUP); + pinMode(BUTTON4, INPUT_PULLUP); + + + + + prefs.begin("kam_alarm"); + + ip_address = prefs.getString("IPADDRESS"); + + WiFi.mode(WIFI_STA); + WiFi.disconnect(); + delay(100); + ssid = prefs.getString("SSID"); + pass = prefs.getString("PASS"); + ssid.toCharArray(ssid_char, 20); + pass.toCharArray(pass_char, 20); + WiFi.begin(ssid_char, pass_char); + + // Allow Time for Wifi Connection 10 seconds + delay(10000); + + // Check if connected to wifi + if (WiFi.status() != WL_CONNECTED) { + WiFi.mode(WIFI_MODE_AP); + WiFi.softAP("KamAlarm", "KAMisFun!"); + WiFi.softAPIP(); + } + + // Send web page with input fields to client + server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { + if (!request->authenticate("admin", "KAM_alarm")) + return request->requestAuthentication(); + + if (request->hasParam("pass") && request->hasParam("ssid")) { + request->send_P(200, "text/html", index_html); + ssid = request->getParam("ssid")->value(); + pass = request->getParam("pass")->value(); + + Serial.print("New Password is:\t"); + Serial.println(pass); + Serial.print("New SSID is:\t"); + Serial.println(ssid); + + prefs.putString("SSID", ssid); + prefs.putString("PASS", pass); + Serial.println("Done"); + } else if (request->hasParam("data")) { + ssid = prefs.getString("SSID"); + pass = prefs.getString("PASS"); + request->send(200, "text/html", "ESP Kid's Alarm

Current WIFI Settings



SSID: \"" + ssid + "\"
Password: \"" + pass + "\"



"); + } else if (request->hasParam("logout")) { + request->send(401, "text/html", "ESP Kid's Alarm

Success





"); + } else if (request->hasParam("ipaddress")) { + request->send_P(200, "text/html", index_html); + ip_address = request->getParam("ipaddress")->value(); + prefs.putString("IPADDRESS", ip_address); + + } else if (request->hasParam("ipget")) { + ip_address = prefs.getString("IPADDRESS"); + request->send(200, "text/html", "ESP Kid's Alarm

Current IP Settings


Remote IP Address: \"" + ip_address + "\"



"); + + + } else if (request->hasParam("count")) { + request->send_P(200, "text/html", index_html); + count = request->getParam("count")->value().toInt(); + + } else if (request->hasParam("got_message")) { + request->send_P(200, "text/html", ""); + gotmessage = true; + + } else { + request->send_P(200, "text/html", index_html); + } + }); + + // Start Server + server.begin(); +} + + + +void loop() { + getconnection(); + + + if (!digitalRead(BUTTON1) && !tone_on) { + + int httpResponseCode = GETRequest("http://admin:KAM_alarm@" + ip_address + "/?comeback=1"); + + Serial.println(httpResponseCode); + if (httpResponseCode != 200) { + failed = true; + } else { + tone_on = true; + } + + while (!digitalRead(BUTTON1)) + ; + } + + if (!digitalRead(BUTTON2)) { + + int httpResponseCode = GETRequest("http://admin:KAM_alarm@" + ip_address + "/?cancel=1"); + + Serial.println(httpResponseCode); + + cancel = true; + + if (httpResponseCode != 200) { + failed = true; + } else { + cancel = true; + } + + while (!digitalRead(BUTTON2)) + ; + } + + if (!digitalRead(BUTTON3)) { + + int httpResponseCode = GETRequest("http://admin:KAM_alarm@" + ip_address + "/?sermonover=1"); + + Serial.println(httpResponseCode); + + if (httpResponseCode != 200) { + failed = true; + } else { + sermon_over = true; + } + + while (!digitalRead(BUTTON3)) + ; + } + + + if (!digitalRead(BUTTON4) && count > 0) { + + + int httpResponseCode = GETRequest("http://admin:KAM_alarm@" + ip_address + "/?receivedcount=1"); + + count = -2; + + + while (!digitalRead(BUTTON4)) + ; + } +} + + + +void getconnection() { + currentMillis = millis(); + if (currentMillis - previousMillis > 10000) { + + int response = GETRequest("http://admin:KAM_alarm@" + ip_address); + + if (response == 200) { + connected = true; + Serial.println("Connected"); + } else { + connected = false; + Serial.println("Not Connected"); + } + previousMillis = currentMillis; + } +} + + + +int GETRequest(String URL) { + int response; + + HTTPClient http; + + http.begin(URL.c_str()); + http.addHeader("Content-Type", "application/x-www-form-urlencoded"); + http.setTimeout(5000); + response = http.GET(); + http.end(); + + Serial.println(URL); + + return response; +} + + +int POSTRequest(String URL) { + int response; + + HTTPClient http; + + http.begin(URL.c_str()); + http.addHeader("Content-Type", "application/x-www-form-urlencoded"); + http.setTimeout(5000); + response = http.POST(""); + http.end(); + + Serial.println(URL); + + return response; +}