Ubidots Community

My code for ESP8266 crushed during connection

Hi to everyone!

I asking for help, wrote simple code to manage temperature in huse, but during connection it’s crushed.

Error code is below:
"
Soft WDT reset

stack>>>

ctx: cont
sp: 3ffffd20 end: 3fffffc0 offset: 01a0
3ffffec0: 40204b98 3ffe8e7f 3ffeee70 40204e94
3ffffed0: 40201a34 40201890 3ffeee70 40204f8c
3ffffee0: 3fffdad0 1101a8c0 00ffffff 40201848
3ffffef0: 00000000 3ffeecfc 3ffeee70 4020183c
3fffff00: 00000000 00000000 40209f10 1101a8c0
3fffff10: 40204b98 00000000 3ffeec74 40201174
3fffff20: 40204b98 3ffe8e7f 3ffeee70 40204e94
3fffff30: 3fffdad0 0000000d 3ffeee70 40204f8c
3fffff40: 3fffdad0 00000000 00007582 3ffeefb0
3fffff50: 3fffdad0 00000000 3ffeef9c 402012ab
3fffff60: 3fffdad0 00000005 7fc00000 00000000
3fffff70: feefeffe 007a1200 302d7784 00000000
3fffff80: 00000000 00000000 00000001 c8f4bff0
3fffff90: 3fffdad0 00000000 3ffeef9c 3ffeefb0
3fffffa0: 3fffdad0 00000000 3ffeef9c 402061a0
3fffffb0: feefeffe feefeffe 3ffe89fc 4010125d
<<<stack<<<
"
Please :pray: help!!!
DACHA_UBIDOTS_POTENT_2021.txt (4.6 KB)

Hello @Mamchur

From a quick look to your code, I believe the use of the Ubidots library isn’t the correct and it’s hard to predict what could be wrong. For example, the line:

int INET = client.ubidotsSubscribe("DACHA","Ttarget");

The ubidotsSubscribe() subscribe method returns a boolean, not an integer. Also, if you’re subscribing using MQTT as the library does, you need to have a callback() function in your code to handle the messages once they arrive from the cloud.

If you are not yet familiar with MQTT or the library, I recommend referring to the below resources first and then attempt developing your own firmware

About MQTT and Ubidots broker
About the library and how to use it: please follow the examples therein.

Best,

–David

1 Like

Hi! Sorry, I just learning C++ (arduino) and for me is complicate to understand some moments, could you explain?

  1. I returned callback() function in to my sketch - nothing has changed, probably some another reason of crush?
  2. I read examples offered by library “UbidotsESPMQTT.h” and did not find another method to get data from ubidots except client.ubidotsSubscribe. Could you advice some another example, i need to get target temp?

@Mamchur please refer to the below article to learn about the use of the library. I recommend to first try out the simple examples therein before adventuring into coding your own firmware, this will give a good grasp of the library methods

To answer your questions:

  1. The code you included before did not contained a callback() function. If you included already that’s fine, but I hardly thing that would the reason causing the code so crash.
  2. You’re correct, client.ubidotsSubscribe is the method to receive data from Ubidots but you need to call it correctly as depicted in the examples of the article.

Please do follow the guide first to make sure you get the introductory examples working.

–David

Dear David, in fact code crushed after established connection with UBIDOTS. Probably necessary make define mqtt server and port?

Hi @Mamchur,

The Ubidots’ library for the ESP8266 already defines the MQTT server and port in the background. No need to do this manually.
Did you you follow the example in the article previous sent? These example are proven to work and they’re the first step into getting to know the library and how it operates.

Hi David!
probably my skill is to low, but I didn’t succeed in my try to use MQTT protocol. But after reading forum, finally successful made code for HTTP exchange.

Hi David!

Could you help me? I wrote code for http data exchange, but something strange happen:
It’s always correct getting data from slider to device,
but send data to ubidots is strange - once not recorded to device i create on web and used key, but create completely new device, with exactly the similar key! More ower, I took my NodeMCU to remoute house and it’s happened once again!
But today I have a little free time in office and was trying to start my progect to fix issues - surprise, this time data not sending at all, just getting data!


1624561813836_UBIDOTS_Http.ino (5.7 KB)