2019-03-14 04:11:59 +00:00
# ESP WebOTA
2019-03-18 01:04:09 +00:00
Easily add web based [OTA ](https://en.wikipedia.org/wiki/Over-the-air_programming ) updates to your ESP32/ESP8266 projects.
2019-03-14 04:11:59 +00:00
## Installation
Clone this repo to your Arduino libraries directory. On Linux this is `~/Arduino/libraries/`
## Usage
2019-03-18 00:58:55 +00:00
Include the WebOTA library
2019-03-14 04:11:59 +00:00
#include < WebOTA.h >
2019-03-18 18:18:48 +00:00
Optionally initialize the WebOTA library if you want to change the defaults. This is done at the end of your `setup()` function:
2019-03-14 04:11:59 +00:00
void setup() {
2019-03-14 15:59:32 +00:00
// Other init code here (WiFi, etc)
2019-03-14 04:11:59 +00:00
2019-03-18 15:03:13 +00:00
// To use a specific port and path uncomment this line
// Defaults are 8080 and "/webota"
2019-03-19 19:25:57 +00:00
// webota.init(8888, "/update");
2019-03-14 04:11:59 +00:00
}
Listen for update requests at the end of your `loop()` function:
void loop() {
// Other loop code here
2019-03-19 19:25:57 +00:00
webota.handle();
2019-03-14 04:11:59 +00:00
}
2019-03-19 19:25:57 +00:00
**Note:** If you have long `delay()` commands in your `loop()` WebOTA may not be responsive. We have provided `webota.delay()` as a drop-in replacement, which is more WebOTA friendly.
2019-03-14 04:11:59 +00:00
2019-03-14 15:59:32 +00:00
## Upload a sketch
2019-03-14 22:44:39 +00:00
You will need to create a binary sketch image to upload. This is done in the Arduino IDE by going to the `Sketch` menu and selecting `Export compiled Binary` .
2019-03-18 01:04:09 +00:00
Navigate to your ESP in a web browser to upload your binary image. Typical URLs are: http://esp-ota.local:8080/webota.
2019-03-14 04:11:59 +00:00
2019-03-18 18:18:48 +00:00
You can also use Curl if you want to script your uploads from the CLI
curl -F "file=@MyImage.bin" http://esp-ota.local:8080/webota
2019-03-14 04:11:59 +00:00
## Based on
Borrowed from [randomnerdtutorials.com ](https://randomnerdtutorials.com/esp32-over-the-air-ota-programming/ ) and improved upon.