From d61834dda9c219ac0418826b57881e8690ad4da8 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Wed, 13 Mar 2019 21:29:53 -0700 Subject: [PATCH] Add an example --- examples/BlinkOTA/BlinkOTA.ino | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/BlinkOTA/BlinkOTA.ino diff --git a/examples/BlinkOTA/BlinkOTA.ino b/examples/BlinkOTA/BlinkOTA.ino new file mode 100644 index 0000000..978baf7 --- /dev/null +++ b/examples/BlinkOTA/BlinkOTA.ino @@ -0,0 +1,31 @@ +const char* host = "ESP32-OTA"; // Used for MDNS resolution +const char* ssid = "ssid"; +const char* password = "password"; + +#include +WebServer OTAServer(8080); + +#define LED_PIN 2 + +// the setup function runs once when you press reset or power the board +void setup() { + Serial.begin(115200); + + // initialize digital pin LED_PIN as an output. + pinMode(LED_PIN, OUTPUT); + + init_wifi(ssid, password, host); + init_web_ota(&OTAServer); +} + +// the loop function runs over and over again forever +void loop() { + int md = 1000; + + digitalWrite(LED_PIN, HIGH); + delay(md); + digitalWrite(LED_PIN, LOW); + delay(md); + + OTAServer.handleClient(); +}