Although this is a really old version of Espruino, and it's content not directly ralated to the MQTT task at hand, does the use of these snippets provide confirmation for at least the WiFi configuration, when MQTT is not referenced in your code?
Could there be some delay setting up SPI after the WiFi init, causing lost packets? After reading the referenced pages here, an untested suggestion might be to set up SPI, then call the WiFi section from a setTimeout() with say a one and a half second delay?
or/and . . .
Try the 'hello.txt' example code block at page end to separate the WiFi from MQTT task, proving out the WiFi code block and gain some hardware confidence.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Sat 2020.01.18
@ScottyMT, I have no experience with MQTT, but does this article and code block provide some insight?
MQTT and Espruino
Although this is a really old version of Espruino, and it's content not directly ralated to the MQTT task at hand, does the use of these snippets provide confirmation for at least the WiFi configuration, when MQTT is not referenced in your code?
Could there be some delay setting up SPI after the WiFi init, causing lost packets? After reading the referenced pages here, an untested suggestion might be to set up SPI, then call the WiFi section from a
setTimeout()
with say a one and a half second delay?or/and . . .
Try the 'hello.txt' example code block at page end to separate the WiFi from MQTT task, proving out the WiFi code block and gain some hardware confidence.
Has the use of the 'debugger' been tried? looking for null and undefined objects
It will be necessary to use the @MaBe conditional example (post #2 there) found following his link in the #4 post above, rather than save() each time.