updates for 12/03/2025

This commit is contained in:
2025-03-12 15:30:04 +02:00
parent c46eaf0f49
commit a33dfcb96e
6 changed files with 121 additions and 27 deletions

View File

@@ -3,7 +3,7 @@
#include <HTTPClient.h>
#include <WebServer.h>
#include "esp_mac.h"
//ver 1.03
//ver 1.04
// Constants for Access Point mode
const char* ap_ssid = "ESP32-AP";
const char* ap_password = "12345678";
@@ -25,6 +25,9 @@ bool isAPMode = false;
// Variable to keep track of the last log time
unsigned long lastLogTime = 0;
// Array to keep track of the previous state of each input pin
bool previousInputState[4] = {HIGH, HIGH, HIGH, HIGH};
// Function to send logs to the log server
void sendLog(String message) {
if (WiFi.status() == WL_CONNECTED && logServerIP.length() > 0 && logServerPort.length() > 0) {
@@ -184,6 +187,19 @@ void loop() {
sendLog("Board is functioning");
lastLogTime = millis();
}
// Check the state of each input pin and log changes
for (int i = 0; i < 4; i++) {
bool currentState = digitalRead(inputPins[i]);
if (currentState != previousInputState[i]) {
if (currentState == LOW) {
sendLog("Input " + String(i + 1) + " pressed");
} else {
sendLog("Input " + String(i + 1) + " released");
}
previousInputState[i] = currentState;
}
}
}
void startAPMode() {