Hello,
I have a problem with my ESP32. I'm running a simple WiFi-Accesspoint program and I'm trying now to read a potentiometer while the server is running... The problem is that i can't read the potentiometer (value is always 0). As soon as i start the program without the webserver it works totally fine.
Any ideas why it's not working ?
The code:
#include <WiFi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
const char* ssid = "ESP32WiFi";
const char* password = "12345";
AsyncWebServer server(80);
#define POTI 14
const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE HTML><html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ESP Web Server</title>
<style>
</style>
</head>
<body>
<h1>body</h1>
<script>
</script>
</body>
</html>
)rawliteral";
void setup(){
pinMode(POTI, INPUT);
Serial.begin(115200);
WiFi.softAP(ssid, password);
IPAddress IP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(IP);
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/html", index_html);
});
server.begin();
}
void loop() {
Serial.println(analogRead(POTI));
}