Essentials for the ESP8266 and ESP32 to get you started with your Arduino project without any of the annoying stuff.
ESPEssentials only needs three lines of additional code:
#include <ESPEssentials.h>
void setup()
{
ESPEssentials::init("Project Name");
}
void loop()
{
ESPEssentials::handle();
}
By default the baud rate will be 115200. You can specify it with
ESPEssentials::init("Project Name", 9600);
All WiFiManager methods can be accessed through the Wifi
instance. For example to reset wifi settings:
ESPEssentials::Wifi.resetSettings();
More information can be found here.
HTTP requests can be initialized within setup()
. For example to reset wifi settings by accessing http://<device-ip>/reset_wifi
:
ESPEssentials::WebServer.on("/reset_wifi", HTTP_GET, [&]() {
ESPEssentials::WebServer.send(200, "text/plain", "Wifi settings reset.");
ESPEssentials::Wifi.resetSettings();
});
Note: The routes /edit
, /handle_update
, /list
, /reboot
and /update
are already used by ESPEssentials and can not be used.
To edit files inside your browser upload /data/edit.htm.gz
to the root directory. The easiest way to do this is by accessing http://<device-ip>/edit
and uploading it from there. Afterwards you can access the file editor via the same URL to edit files directly on the device.
Each file created/uploaded that way can be accessed via the corresponding URL (e.g. http://<device-ip>/myPage
to access /myPage.htm
).
An OTA password can be set up with
ESPEssentials::init("Project Name", "hunter2");
Open http://<device-ip>/update
and select a .bin
file to upload a new firmware to the ESP8266/ESP32 from within the web browser. If a password has been supplied to init
you will be asked to authenticate. The username is admin
.