🫑 A retrofitted wired audio doorbell with added WiFi connectivity 🔔
This example shows how to use the ESP32-C3 dev board to do the following:
if (button is pressed) {
wakeup from deep sleep
if (Wifi is connected) {
if (current time is appropriate) {
ring the bell
}
display Wifi SSID
check battery level
if (environment is production) {
prepare the payload
send a HTTPS POST to Zapier
}
} else {
ring the bell
check battery level
}
if (battery level is below 20%) {
blink the LED per second for 30 seconds
} else {
delay to mute bell for 30 seconds
}
go back to sleep
}
And in function names:
void setup() {
if (isWifiConnected()) {
if (isTimeAppropriate()) {
ringBell();
}
displayWifiSSID();
checkBatteryLevel();
sendWebhookToZapier();
} else {
ringBell();
checkBatteryLevel();
}
if (isBatteryLow()) {
blinkLowBattLED();
} else {
delayToMuteBell();
}
goBackToSleep();
}