-->
Page 1 of 6

MQTT with PubSubClient library

PostPosted: Fri Mar 27, 2015 11:56 pm
by igrr
One of the nice features of the ESP8266WiFi library bundled with the IDE is that it is mostly compatible with the standard Arduino WiFi Shield library. Some libraries like PubSubClient can therefore use ESP8266WiFi library without modifications.
Here is an example sketch that shows how to use PubSubClient on ESP8266:
https://gist.github.com/igrr/7f7e7973366fc01d6393

Re: MQTT with PubSubClient library

PostPosted: Sat Mar 28, 2015 11:15 am
by Mikejstb
I just downloaded the ESP-Arduino package, tried to compile your example, got the compile error so copied libiconv-2.dll over - now when I try to compile I get this -
Code: Select allArduino: 1.6.1 (Windows 8.1), Board: "Generic ESP8266 board"

[i]esp8266_pubsubclient.ino:1:26: fatal error: PubSubClient.h: No such file or directory

compilation terminated.

Error compiling.
[/i]

here's the verbose error info -
Code: Select allArduino: 1.6.1 (Windows 8.1), Board: "Generic ESP8266 board"

Build options changed, rebuilding all

Using library ESP8266WiFi in folder: D:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1\hardware\esp8266com\esp8266\libraries\ESP8266WiFi



D:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1/hardware/tools/esp8266/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -ID:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1/hardware/tools/esp8266/sdk//include -c -Os -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -std=c++11 -MMD -DF_CPU=80000000L -DARDUINO=10601 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -ID:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1\hardware\esp8266com\esp8266\cores\esp8266 -ID:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1\hardware\esp8266com\esp8266\variants\esp01 -ID:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1\hardware\esp8266com\esp8266\libraries\ESP8266WiFi\src C:\Users\Michael\AppData\Local\Temp\build7464644365248102153.tmp\esp8266_pubsubclient.cpp -o C:\Users\Michael\AppData\Local\Temp\build7464644365248102153.tmp\esp8266_pubsubclient.cpp.o

esp8266_pubsubclient.ino:1:26: fatal error: PubSubClient.h: No such file or directory

compilation terminated.

Error compiling.


any ideas?

BTW - thanks for what must have been a ton of work to make this Arduino environment happen!

Re: MQTT with PubSubClient library

PostPosted: Sat Mar 28, 2015 11:17 am
by Mikejstb
Sorry - I forgot to check the "notify me about replies" option. I don't know if that can be done after the fact so I'm doing it now with this reply...

Re: MQTT with PubSubClient library

PostPosted: Sat Mar 28, 2015 11:35 am
by igrr
@Mikejstb
Did you get the PubSubClient library from Github? You need to unpack it and place it into your My Documents/Arduino/libraries directory (or whatever directory is configured as your sketch directory in Arduinio preferences).