Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By parrotface
#33251 Hi
tried your suggestion ESP8266mDNS\mDNS_Web_Server example and that wont compile error below

/home/roger/Sketchbook/libraries/Temp/ESP8266mDNS.cpp: In member function 'bool MDNSResponder::begin(const char*, IPAddress, uint32_t)':
/home/roger/Sketchbook/libraries/Temp/ESP8266mDNS.cpp:195:12: error: 'class UdpContext' has no member named 'onRx'
_conn->onRx(std::bind(&MDNSResponder::update, this));
^

Do you think I might have libaries problem
Many Thanks
User avatar
By hoatienii
#47990 Please help me! error when compile.

E:\DIY\ESP8266\ESP_WiFiSwitch-master\ESP_WiFiSwitch\ESP_WiFiSwitch.ino: In function 'void launchWeb(int)':

ESP_WiFiSwitch:477: error: 'class PubSubClient' has no member named 'setBrokerDomain'

mqttClient.setBrokerDomain((char*) mqttServer.c_str());

^

ESP_WiFiSwitch:478: error: 'class PubSubClient' has no member named 'setPort'

mqttClient.setPort(1883);

^
User avatar
By djrm
#58089 I have found that the mqtt connect functions which do not compile may be be replaced with an different function call. See the two commented out lines and the preceding line below:
Code: Select all          mqttClient.setServer((char*) mqttServer.c_str(), 1883);
          //mqttClient.setBrokerDomain((char*) mqttServer.c_str());
          //mqttClient.setPort(1883);
With this change I have found that either the suggested pubsubclient library or the one which is in library manager can be used - I'm not sure what the differences are.

I have made another small change to suit my intended use, this changes the switch status mqtt message whenever the switch is changed, either by local button or remote set message. The feedback available at the remote site is then always the true status of the switch.

hth, David.