Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By EREN MERT
#57536 Hello
great example and I also started reading your blog thank you.
I want to try this but i got an error. I tried with v1.9 and last version of pubsubclient. Do I need other libraries?


In file included from C:\xxx\Desktop\MqttTimer\MqttTimer.ino:39:0:
sketch\globals.h: In function 'void ConnectMQTT()':
globals.h:195: error: 'MQTT' has not been declared
while (!client.connect(MQTT::Connect(config.clientID).set_auth(config.MQTTuser, config.MQTTpass)) && retries--)
^
In file included from C:\xxx\Desktop\MqttTimer\MqttTimer.ino:40:0:
sketch\MQTTHandler.h: At global scope:
MQTTHandler.h:7: error: 'MQTT' does not name a type
void callback(const MQTT::Publish& pub)
^
MQTTHandler.h:7: error: expected unqualified-id before '&' token
void callback(const MQTT::Publish& pub)
^
MQTTHandler.h:7: error: expected ')' before '&' token
MQTTHandler.h:7: error: expected initializer before 'pub'
void callback(const MQTT::Publish& pub)
^
exit status 1
'MQTT' has not been declared
User avatar
By Godfather
#57571 Hi not sure why you're getting errors like that?

Pubsubclient should be v1.9 also make sure you don't change the order of the include libraries in the main
sketch.
User avatar
By ChenBH
#57584 That was the next stage in my home automation project!

I needed the knowledge and implementation of MQTT and NTP to make some timer-controled devices.

Thanks man.