Examples

You can find a complete example Here. The library is compatible with ESP32 and ESP8266 with no action, just include otadrive_esp.h and start to use our service like charm.

This video shows step by step adding OTAdrive to your project:

The following code shows all features of this library:

#include <otadrive_esp.h>
...
...
...
// do it every 5 minutes (300 seconds)
if(OTADRIVE.timeTick(300))
{
    // retrive firmware info from OTAdrive server
    updateInfo inf = OTADRIVE.updateFirmwareInfo();
    // update firmware if newer available
    if (inf.available)
    {
        Serial.printf("\nNew version available: %s, %dBytes\n",inf.version.c_str(), inf.size);
        OTADRIVE.updateFirmware();
    }
    else
    {
        Serial.println("No newer version");
    }

    // sync local files with OTAdrive server
    OTADRIVE.syncResources();
    // list local files to serial port
    listDir(FILESYS, "/", 0);

    // get configuration of device
    String c = OTADRIVE.getConfigs();
    Serial.printf("\nconfiguration: %s\n", c.c_str());
}