Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By Mikejstb
#12841 no, I hadn't - I only had the esp8266_pubsubclient.ino file from the example link.
But I went to the github you said, got that package and put it in the new arduino folder under libraries.
Now there are some examples that show up in the IDE - I choose the mqtt basic but it still won't compile.
Here's the error now
Code: Select allArduino: 1.6.1 (Windows 8.1), Board: "Generic ESP8266 board"

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

Using library Ethernet in folder: D:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1\libraries\Ethernet

Using library PubSubClient in folder: D:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1\libraries\PubSubClient (legacy)



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\SPI -ID:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1\libraries\Ethernet\src -ID:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1\libraries\PubSubClient C:\Users\Michael\AppData\Local\Temp\build2522091429104000772.tmp\mqtt_basic.cpp -o C:\Users\Michael\AppData\Local\Temp\build2522091429104000772.tmp\mqtt_basic.cpp.o

mqtt_basic.ino: In function 'void setup()':

mqtt_basic.ino:28:37: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

mqtt_basic.ino:29:44: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

mqtt_basic.ino:29:44: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

mqtt_basic.ino:30:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

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\SPI -ID:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1\libraries\Ethernet\src -ID:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1\libraries\PubSubClient -ID:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1\hardware\esp8266com\esp8266\libraries\SPI\utility D:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1\hardware\esp8266com\esp8266\libraries\SPI\SPI.cpp -o C:\Users\Michael\AppData\Local\Temp\build2522091429104000772.tmp\SPI\SPI.cpp.o

D:\ESP8266\tools-utilites\arduino-1.6.1-windows\arduino-1.6.1\hardware\esp8266com\esp8266\libraries\SPI\SPI.cpp:14:18: fatal error: HSPI.h: No such file or directory

 #include "HSPI.h"

                  ^

compilation terminated.

Error compiling.


I don't find "HSPI.h" anywhere
User avatar
By igrr
#12844 Looks like the example bundled with PubSubClient library wants to use the Ethernet Shield library. No doubt it won't work on ESP.
I would suggest you to try the esp8266_pubsubclient.ino example first.
User avatar
By Mikejstb
#12848 Thank you - that (going back to the original arduino sketch) worked.
What a morning!
All of the hoops to jump through
- getting the ESP Arduino IDE installed
- getting the missing .dll,
- then I need ESPtool to download to my ESP
- which needs PySerial
- which needs Python (apparently 2.7, NOT 3.whatever)
none of the "easy" installs of any of these python utilites worked, so I had to do them all manually - add the paths into my path - ugh!

Anyway - it just compiled and uploaded into my ESP! Yea!
Now to see if it works! ---- drumroll ...

Yes - I see the pubs when I subscribe to them- YEA!!!

Now to see if my previous lua problem with not being able to reconnect to my mqtt broker after 5 minutes of inactivity will work. Yes, I bumped the keep alive number up to 10 minutes.

Thanks again for all of your hard work and for your excellent support! :D
User avatar
By Mikejstb
#12849 well that didn't take too long for another question.
With a 60 second delay between pubs I'm getting this -
Code: Select allMQTT connect failed
Will reset and try again...

 ets Jan  8 2013,rst cause:4, boot mode:(1,7)

wdt reset


Would you agree that the ESP wdt is timing out?
can you tell me how to reset the wdt in the Arduino environment?
Or is there something else that I'm missing?
Also for future questions - is there an api published that I can look to for questions like this?