-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathota_httpserver_blink.ino
37 lines (30 loc) · 1 KB
/
ota_httpserver_blink.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266HTTPUpdateServer.h>
ESP8266WebServer httpServer(80);
ESP8266HTTPUpdateServer httpUpdater;
void setup(void){
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
Serial.println();
Serial.println("Iniciando...");
WiFi.mode(WIFI_AP_STA);
WiFi.begin("SSID", "PASSWORD");
while(WiFi.waitForConnectResult() != WL_CONNECTED){
WiFi.begin("SSID", "PASSWORD");
Serial.println("Falha no Wifi, tentando novamente...");
}
httpUpdater.setup(&httpServer);
httpServer.begin();
Serial.print("HTTPUpdateServer pronto! V� para http://");
Serial.print(WiFi.localIP());
Serial.println("/update no seu navegador\n");
}
void loop(void){
httpServer.handleClient();
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000);
}