Skip to content

srwi/ESPEssentials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESPEssentials

ESP8266 ESP32 arduino-library-badge LGPL-2.1 license

Essentials for the ESP8266 and ESP32 to get you started with your Arduino project without any of the annoying stuff.

Features

  • Serial output
  • Wifi connection management using WiFiManager
  • Webserver including file upload and editing via browser
  • OTA firmware update
  • Web firmware update

Requirements

Usage

ESPEssentials only needs three lines of additional code:

#include <ESPEssentials.h>

void setup()
{
    ESPEssentials::init("Project Name");
}

void loop()
{
    ESPEssentials::handle();
}

Notes

Serial

By default the baud rate will be 115200. You can specify it with

ESPEssentials::init("Project Name", 9600);

WiFiManager

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.

Webserver

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).

OTA firmware update

An OTA password can be set up with

ESPEssentials::init("Project Name", "hunter2");

Web firmware update

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.