I am making a monitor for my shop air compresser to shut the compressor down if the discharge goes higher than 235F. This is the factory setting so I will stick with it. Here is the issue: Most times it can not connect to the WiFi due to distance from router. For the watching of the temp this is not an issue. What I have done is set a timeout such that if it doesn’t connect on startup, it just moves on and watches the probe.
What I want it to do is go to access point mode (maybe?) so that I could at least connect to it with my phone to have a look at the settings. I am not sure how to do this.
So to recap: best choice connect to network, if that is lost or fails switch to AP mode (unless there is a better mode?), from AP mode be able to scan for networks and show choices to connect to.
I am not new to embedded programming, but am super newbie to WiFi, HTML,CSS,all the web things. I understand them when I read them, just not quite up to churning out new code yet.
Hi Howard.
I’m sorry for the delay…
If you set it as an access point, you can connect to it with your phone to monitor. We have a tutorial on how to set up your web server as an access point:
In that tutorial, we explain the main lines of code you should add to turn your ESP32 into an access point.
To check if the ESP32 is able to connect to Wi-Fi, you can use the following expression.
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
//add some sort of timer, or counter
}
But instead of just printing dots, you can create a variable or counter that counts how many times it tries to connect. After a determined number of fails, run another part of the code that sets the access point.
I hope this helps.
Then, let me know if you need further help.
Regards,
Sara