Browse Source

added wifi manager

master
Vladimir Smagin 3 months ago
parent
commit
8c53d96c36
2 changed files with 9 additions and 7 deletions
  1. 9
    4
      tm1640-ntp.ino
  2. 0
    3
      wifi.h.sample

+ 9
- 4
tm1640-ntp.ino View File

@@ -6,7 +6,9 @@
6 6
 #include <ESP8266WiFi.h>
7 7
 #include <ESP8266HTTPClient.h>
8 8
 
9
-#include "wifi.h"
9
+#include <DNSServer.h>
10
+#include <ESP8266WebServer.h>
11
+#include <WiFiManager.h>
10 12
 
11 13
 #define ONBOARDLED 2 // Built in LED on ESP-12/ESP-07
12 14
 
@@ -77,9 +79,9 @@ void setup() {
77 79
   digitalWrite(ONBOARDLED, HIGH); 
78 80
 
79 81
   //Serial.begin(115200);
80
-  WiFi.mode(WIFI_STA);
81
-  WiFi.hostname("clock-x16");
82
-  WiFi.begin(YOUR_WIFI_SSID, YOUR_WIFI_PASSWD);
82
+  //WiFi.mode(WIFI_STA);
83
+  WiFi.hostname("clock-x16-01");
84
+  //WiFi.begin(YOUR_WIFI_SSID, YOUR_WIFI_PASSWD);
83 85
 
84 86
   pinMode(ONBOARDLED, OUTPUT); // Onboard LED
85 87
   digitalWrite(ONBOARDLED, HIGH); // Switch off LED
@@ -93,6 +95,9 @@ void setup() {
93 95
   e2 = WiFi.onStationModeDisconnected(onSTADisconnected);
94 96
   e3 = WiFi.onStationModeConnected (onSTAConnected);
95 97
   digitalWrite(ONBOARDLED, HIGH); // Switch off LED
98
+  WiFiManager wifiManager;
99
+  wifiManager.autoConnect("clock-x16-01");
100
+  
96 101
 }
97 102
 
98 103
 void starting() {

+ 0
- 3
wifi.h.sample View File

@@ -1,3 +0,0 @@
1
-#define YOUR_WIFI_SSID "supapupamegawifi"
2
-#define YOUR_WIFI_PASSWD "sexdrugsrickroll"
3
-

Loading…
Cancel
Save