Wifi IOT Module does not connect to thingspeak gives a memory error

userHead Gemini 2024-07-27 14:37:38 639 Views1 Replies

I have used the new library located here: https://github.com/DFRobot/DFRobot_WiFi_IoT_Module

However the sample code given as a basis for sending data off of the DF Robot Environmental Sensor gives a memory allocation error when trying to upload to thingspeak. I'm using in I2C mode.

 

Here is snippet of code where this occurs.

 

Hope someone can help

  case 'X' : thingspeakdata = read0501data();
     String temperature=(String)thingspeakdata.wxdata[0];
     String pressure=(String)thingspeakdata.wxdata[1];
     IoT.thingSpeakSendMessage(temperature.c_str(), pressure.c_str());   
     delay(2000);

 

At the thingSpeakSendMessage line the program halts with memory allocation error.  I do not get a low memory warning on compilation so not sure why this is occurring.  

2024-07-29 16:38:06

You can check the actual memory usage during runtime. You can do this by adding some code to monitor the free memory:

 

#include <MemoryFree.h> // You may need to install this library

void checkMemory() {
 Serial.print("Free memory: ");
 Serial.println(freeMemory());
}
 

userHeadPic lia.ifat