updates for 12/03/2025
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user