Skip to content

Commit 8798525

Browse files
committed
Fix mDNS library usage in ESP8266WebServer examples
1 parent a39ce29 commit 8798525

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

hardware/esp8266com/esp8266/libraries/ESP8266WebServer/examples/AdvancedWebServer/AdvancedWebServer.ino

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/*
22
* Copyright (c) 2015, Majenko Technologies
33
* All rights reserved.
4-
*
4+
*
55
* Redistribution and use in source and binary forms, with or without modification,
66
* are permitted provided that the following conditions are met:
7-
*
7+
*
88
* * Redistributions of source code must retain the above copyright notice, this
99
* list of conditions and the following disclaimer.
10-
*
10+
*
1111
* * Redistributions in binary form must reproduce the above copyright notice, this
1212
* list of conditions and the following disclaimer in the documentation and/or
1313
* other materials provided with the distribution.
14-
*
14+
*
1515
* * Neither the name of Majenko Technologies nor the names of its
1616
* contributors may be used to endorse or promote products derived from
1717
* this software without specific prior written permission.
18-
*
18+
*
1919
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
2020
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2121
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -35,7 +35,6 @@
3535

3636
const char *ssid = "YourSSIDHere";
3737
const char *password = "YourPSKHere";
38-
MDNSResponder mdns;
3938

4039
ESP8266WebServer server ( 80 );
4140

@@ -109,7 +108,7 @@ void setup ( void ) {
109108
Serial.print ( "IP address: " );
110109
Serial.println ( WiFi.localIP() );
111110

112-
if ( mdns.begin ( "esp8266", WiFi.localIP() ) ) {
111+
if ( MDNS.begin ( "esp8266" ) ) {
113112
Serial.println ( "MDNS responder started" );
114113
}
115114

hardware/esp8266com/esp8266/libraries/ESP8266WebServer/examples/HelloServer/HelloServer.ino

+9-10
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
#include <WiFiClient.h>
33
#include <ESP8266WebServer.h>
44
#include <ESP8266mDNS.h>
5-
5+
66
const char* ssid = "........";
77
const char* password = "........";
8-
MDNSResponder mdns;
98

109
ESP8266WebServer server(80);
1110

@@ -33,7 +32,7 @@ void handleNotFound(){
3332
server.send(404, "text/plain", message);
3433
digitalWrite(led, 0);
3534
}
36-
35+
3736
void setup(void){
3837
pinMode(led, OUTPUT);
3938
digitalWrite(led, 0);
@@ -51,23 +50,23 @@ void setup(void){
5150
Serial.println(ssid);
5251
Serial.print("IP address: ");
5352
Serial.println(WiFi.localIP());
54-
55-
if (mdns.begin("esp8266", WiFi.localIP())) {
53+
54+
if (MDNS.begin("esp8266")) {
5655
Serial.println("MDNS responder started");
5756
}
58-
57+
5958
server.on("/", handleRoot);
60-
59+
6160
server.on("/inline", [](){
6261
server.send(200, "text/plain", "this works as well");
6362
});
6463

6564
server.onNotFound(handleNotFound);
66-
65+
6766
server.begin();
6867
Serial.println("HTTP server started");
6968
}
70-
69+
7170
void loop(void){
7271
server.handleClient();
73-
}
72+
}

0 commit comments

Comments
 (0)