delete esp_gateway, it was just a trial
This commit is contained in:
parent
0d24e1a82d
commit
f5c0ca03d7
@ -1,54 +0,0 @@
|
|||||||
#include "Arduino.h"
|
|
||||||
#include <WiFi.h>
|
|
||||||
#include <WiFiUdp.h>
|
|
||||||
#include <ESPmDNS.h>
|
|
||||||
#include <ArduinoOTA.h>
|
|
||||||
|
|
||||||
const char* ssid = "vulturul";
|
|
||||||
const char* password = "***REMOVED***";
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
Serial.begin(9600); // Start the serial console
|
|
||||||
WiFi.mode(WIFI_STA);
|
|
||||||
WiFi.begin(ssid, password);
|
|
||||||
|
|
||||||
Serial.println("Connecting to WiFi netowrk.");
|
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
|
||||||
delay(1000);
|
|
||||||
Serial.println("Establishing connection to WiFi..");
|
|
||||||
}
|
|
||||||
Serial.println("Connected to network");
|
|
||||||
|
|
||||||
setupOTA();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
ArduinoOTA.handle();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setupOTA() {
|
|
||||||
ArduinoOTA.onStart([]() {
|
|
||||||
Serial.println("Start");
|
|
||||||
});
|
|
||||||
ArduinoOTA.onEnd([]() {
|
|
||||||
Serial.println("\nEnd");
|
|
||||||
});
|
|
||||||
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
|
|
||||||
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
|
|
||||||
});
|
|
||||||
ArduinoOTA.onError([](ota_error_t error) {
|
|
||||||
Serial.printf("Error[%u]: ", error);
|
|
||||||
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
|
|
||||||
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
|
|
||||||
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
|
|
||||||
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
|
|
||||||
else if (error == OTA_END_ERROR) Serial.println("End Failed");
|
|
||||||
});
|
|
||||||
ArduinoOTA.begin();
|
|
||||||
Serial.println("Ready");
|
|
||||||
Serial.print("IP address: ");
|
|
||||||
Serial.println(WiFi.localIP());
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user