File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 1
- #include < Arduino.h>
2
1
#include < ESP8266WiFi.h>
3
2
#include < WiFiClient.h>
4
3
#include < ESP8266WebServer.h>
5
4
#include < ESP8266mDNS.h>
6
5
7
- const char * ssid = " ******" ;
8
- const char * password = " ******" ;
9
- MDNSResponder mdns;
6
+ const char * ssid = " ........" ;
7
+ const char * password = " ........" ;
10
8
11
9
ESP8266WebServer server (80 );
12
10
@@ -39,6 +37,7 @@ void setup(void){
39
37
pinMode (led, OUTPUT);
40
38
digitalWrite (led, 0 );
41
39
Serial.begin (115200 );
40
+ WiFi.mode (WIFI_STA);
42
41
WiFi.begin (ssid, password);
43
42
Serial.println (" " );
44
43
@@ -53,7 +52,7 @@ void setup(void){
53
52
Serial.print (" IP address: " );
54
53
Serial.println (WiFi.localIP ());
55
54
56
- if (mdns .begin (" esp8266" , WiFi. localIP () )) {
55
+ if (MDNS .begin (" esp8266" )) {
57
56
Serial.println (" MDNS responder started" );
58
57
}
59
58
@@ -71,4 +70,4 @@ void setup(void){
71
70
72
71
void loop (void ){
73
72
server.handleClient ();
74
- }
73
+ }
Original file line number Diff line number Diff line change 1
1
/*
2
- * This sketch demonstrates how to scan WiFi networks.
3
- * The API is almost the same as with the WiFi Shield library,
2
+ * This sketch demonstrates how to scan WiFi networks.
3
+ * The API is almost the same as with the WiFi Shield library,
4
4
* the most obvious difference being the different file you need to include:
5
5
*/
6
- #include < Arduino.h>
7
6
#include " ESP8266WiFi.h"
8
7
9
8
void setup () {
You can’t perform that action at this time.
0 commit comments