Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By kas
#29959 Did you modify MQTT_led_V1.06.ino by any means ??

In IDE, go to Menu/tools/board:"generic ESP8266 module"/Boards manager
and confirm your package version (mine is 1.6.5-1106-g8253b82)
Make sure you see "Adafruit HUZZAH", "SparkFun ESP8266 Thing" and "SweetPea ESP-210" as available boards in the tools/board:"generic ESP8266 module" Menu

Finally, load and try compiling libraries\pubsubclient-master\examples\mqtt_basic\mqtt_basic.ino

FWIW, I just upgraded Imroy/pubsubclient to the latest version (Aug 6th, 2015), it compiles flawlessly
User avatar
By picstart
#29972 I'm using MQTT_led_v1.06 arduino 1.6.5 the MQTT_led_v1.06 is unmodified
Tools board manager esp8266 version is 1.6.5-947-g39819f0 I was using arduino 1.6.2 and just the generic esp82666 board.
Mostly if it isn't broken I don't upgrade since all to often it leads to little satisfaction since the gain is small and the risk to the stability of an existing system is high. In this case things are broken and I have a back up so I can return to 1.6.2 if needed.
I have upgraded to 1/6/5 and learned a lot form this ...mostly that there are massive dependencies with the Arduino IDE

kas thanks for your help with this but the errors are still there

I have learned a lot form this ...mostly that there are massive dependencies with the Arduino IDE between versions boards etc.


Issue
The error appears to be with the MQTT code since it persists in different versions of the Arduino IDE
The MQTT.cpp has no internal versioning information in the code file so could have out of date code

Here is what is in the code file
MQTT.cpp - MQTT packet classes
Copyright (C) 2015 Ian Tester

Compile errors

[code]In file included from MQTT.cpp:20:0:
MQTT.h:278: error: '__FlashStringHelper' does not name a type
Publish(String topic, const __FlashStringHelper* payload);
^
MQTT.h:278: error: ISO C++ forbids declaration of 'payload' with no type [-fpermissive]
Publish(String topic, const __FlashStringHelper* payload);
^
MQTT.h:280: error: 'PGM_P' has not been declared
friend Publish Publish_P(String topic, PGM_P payload, uint32_t length);
^
MQTT.h:321: error: 'PGM_P' has not been declared
Publish Publish_P(String topic, PGM_P payload, uint32_t length);
^
MQTT.cpp:358: error: '__FlashStringHelper' does not name a type
Publish::Publish(String topic, const __FlashStringHelper* payload) :
^
MQTT.cpp:358: error: ISO C++ forbids declaration of 'payload' with no type [-fpermissive]
Publish::Publish(String topic, const __FlashStringHelper* payload) :
[/code]

Later today I'll retest my esp8266 code that compiled under 1.6.2 to see if it still works....hopefully it will.
User avatar
By kas
#29974 picstart,
Just to make sure,
- can you see "Adafruit HUZZAH", "SparkFun ESP8266 Thing" and "SweetPea ESP-210" as available boards in the tools/board:"generic ESP8266 module" Menu ??
- can you load and compile the libraries\pubsubclient-master\examples\mqtt_basic\mqtt_basic.ino example sketch ??
User avatar
By picstart
#29975 can you see "Adafruit HUZZAH", "SparkFun ESP8266 Thing" and "SweetPea ESP-210" as available boards in the tools/board:"generic ESP8266 module" Menu ?? Yes
- can you load and compile the libraries\pubsubclient-master\examples\mqtt_basic\mqtt_basic.ino example sketch ??
here are the errors with mqtt_basic.ino
[code]In file included from MQTT.cpp:20:0:
MQTT.h:278: error: '__FlashStringHelper' does not name a type
Publish(String topic, const __FlashStringHelper* payload);
^
MQTT.h:278: error: ISO C++ forbids declaration of 'payload' with no type [-fpermissive]
Publish(String topic, const __FlashStringHelper* payload);
^
MQTT.h:280: error: 'PGM_P' has not been declared
friend Publish Publish_P(String topic, PGM_P payload, uint32_t length);
^
MQTT.h:321: error: 'PGM_P' has not been declared
Publish Publish_P(String topic, PGM_P payload, uint32_t length);[/code]
Some news
A very basic blink led arduino esp8266 code set is compiling uploading and running with 1.6.5 so the upgrade hasn't so far broken things but again it has minimal dependencies...no convoluted *h that calls a *.cpp that in turn calls *.h and so forth through a convoluted path.

I'm not convinced I have the same *h *cpp source code as you but I'm mostly sure I have the same IDE and compiler.
Thanks for your help
I have a raspi mosquitto broker up and running with a PC client using my own lazarus and an android client with basic4 code....I was hoping to get an esp8266 client into the mix.