1 [env:d1_mini_lite]
2 platform = espressif8266
3 board = d1_mini_lite
4 framework = arduino
5 monitor_speed = 115200
6 build_flags =
7 -D MPU=ESP8266
8
9 [env:M3] // THIS ONE ACTUALLY WORKS!!!
10 platform = espressif8266
11 board = d1_mini
12 framework = arduino
13 monitor_speed = 115200
14 board_build.ldscript = eagle.flash.1m.ld
15 build_flags =
16 -D MPU=ESP8266
17
18 [env:oops] // Use this one to "Monitor" if something borks...
19 platform = espressif8266
20 board = d1_mini
21 framework = arduino
22 monitor_speed = 78400
1 const char *host = "Device Name";
2 const char *ssid = "SSID";
3 const char *password = "Password";
1 #include <Arduino.h>
2
3 #include <ESP8266WebServer.h>
4 #include <ESP8266HTTPUpdateServer.h>
5
6 void WiFi_Setup();
7
8
9 ESP8266WebServer httpServer(80);
10 ESP8266HTTPUpdateServer httpUpdater;
11
12 String TestPage =
13 "<H1>This</H1>"
14 "<H2>is only a</H2>"
15 "<H1>TEST!</H1>"
16 "<a href='/update'>Update Page</a>";
17 void handleRootPath();
18
19 void setup(void) {
20
21 Serial.begin(115200);
22 Serial.println();
23 Serial.println("Booting Sketch...");
24
25 WiFi_Setup();
26
27 httpUpdater.setup(&httpServer);
28 httpServer.begin();
29
30 httpServer.on("/", handleRootPath);
31
32 Serial.printf("HTTPUpdateServer ready! Open http://%s/update in your browser\n", WiFi.localIP().toString().c_str());
33 }
34
35 void loop(void) {
36 httpServer.handleClient();
37 }
38
39 void handleRootPath() {
40
41 httpServer.send(200, "text/plain", "Hello world");
42
43 }
1 #if MPU == ESP8266
2 #include <ESP8266WiFi.h>
3 #include <WiFiClient.h>
4 #elif MPU == ESP32
5 #include <WiFi.h>
6 #include <WiFiClient.h>
7 #endif
8
9 #include "TopSecret.h"
10
11 void WiFi_Setup()
12 {
13 WiFi.mode(WIFI_STA);
14 WiFi.begin(ssid, password);
15
16 // Wait for connection
17 while (WiFi.status() != WL_CONNECTED)
18 {
19 delay(500);
20 Serial.print(".");
21 }
22 Serial.println("");
23 Serial.printf("Connected to %s\n", ssid);
24 Serial.printf("IP address: %s\n", WiFi.localIP().toString().c_str());
25 }