kam-alarm/ESP32 Code/sound/sound.ino
2024-07-27 10:37:54 -04:00

609 lines
38 KiB
C++
Executable File

#include <Arduino.h>
#include <WiFi.h>
#include <ESPAsyncWebServer.h>
#include <Preferences.h>
#include <ESP32Ping.h>
#include <HTTPClient.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
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(
<!DOCTYPE HTML>
<html>
<head>
<title>ESP Kid's Alarm Sound</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
}
#container {
text-align: center;
background-color: white;
padding: 20px;
border-radius: 10px;
}
#logout_button {
position: absolute;
top: 20px;
right: 20px;
}
h1 {
margin-top: 0;
}
h2 {
margin-bottom: 10px;
}
form {
margin-bottom: 20px;
}
input[type="text"],
input[type="password"] {
width: 200px;
}
button,
input[type="submit"] {
padding: 10px 20px;
cursor: pointer;
background-color: #007bff;
border: none;
color: white;
border-radius: 5px;
}
button:hover,
input[type="submit"]:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div id="logout_button">
<button onclick="window.location.href='/?logout=1';">Logout</button>
</div>
<div id="container">
<h1>ESP Kid's Alarm Soud</h1>
<hr>
<h2>Change WIFI Password</h2>
<form action="/" id="form_wifi">
SSID: <input type="text" name="ssid" id="ssid">
<br>
Password: <input type="password" name="pass" id="pass">
<br>
<input type="submit" value="Update Wifi" id="submit_wifi">
</form>
<button onclick="window.location.href='/?data=1';">Get Current Wifi Data</button>
<br>
<br>
<br>
<h2>Set Remote Alarm IP</h2>
<form action="/" id="form_key">
<input type="text" minlength="7" maxlength="15" size="1" id="ipaddress" name="ipaddress" placeholder="xxx.xxx.xxx.xxx" autocomplete="off">
<br>
<input type="submit" value="Update IP" id="submit_ip">
</form>
<button onclick="window.location.href='/?ipget=1';">Get Current Remote IP</button>
<script>
document.getElementById('submit_wifi').disabled = true;
document.getElementById('submit_ip').disabled = true;
document.addEventListener('keyup', e => {
if (document.getElementById('ssid').value == "" || document.getElementById('pass').value == "") {
document.getElementById('submit_wifi').disabled = true;
} else {
document.getElementById('submit_wifi').disabled = false;
}
if (document.getElementById("ipaddress").value == "") {
document.getElementById('submit_ip').disabled = true;
} else {
document.getElementById('submit_ip').disabled = false;
}
});
</script>
</div>
</body>
</html>
)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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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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, 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 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", "<!DOCTYPE HTML><html><head><title>ESP Kid's Alarm</title><meta name='viewport' content='width=device-width, initial-scale=1'></head><body><h1>Current WIFI Settings</h1><hr><br/>SSID: \"" + ssid + "\"<br/>Password: \"" + pass + "\"<br/><br/><br/><hr><button onclick=\"window.location.href='/';\">Back</button></body></html>");
} else if (request->hasParam("logout")) {
request->send(401, "text/html", "<!DOCTYPE HTML><html><head><title>ESP Kid's Alarm</title><meta name='viewport' content='width=device-width, initial-scale=1'></head><body><h1>Success</h1><hr><br/><br/><br/><button onclick=\"window.location.href='/';\">Login</button></body></html>");
} 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", "<!DOCTYPE HTML><html><head><title>ESP Kid's Alarm</title><meta name='viewport' content='width=device-width, initial-scale=1'></head><body><h1>Current IP Settings</h1><hr>Remote IP Address: \"" + ip_address + "\"<br/><br/><br/><hr><button onclick=\"window.location.href='/';\">Back</button></body></html>");
} 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;
}