Problem with Arduino Thingspeak.writeFields() not updating fields correctly | ThingSpeak API | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Problem with Arduino Thingspeak.writeFields() not updating fields correctly
No permission to create posts
May 19, 2017
12:27 am
Avatar
JK
New Member
Members
Forum Posts: 2
Member Since:
May 19, 2017
sp_UserOfflineSmall Offline

Writing to more than 5 fields with the .writeFields() function causes the Thingspeak server to receive all null data. The channel is setup properly. I have tried deleting and recreating the channel, switched the order of writes, nothing works. The stranger thing is that it all worked a few days ago.

Remove the set for "field6", works fine. Add it back... server gets null for all fields (but it does get an entry). All fields are of the same "int" type.

  ThingSpeak.setField(1, var1);
  ThingSpeak.setField(2, var2);
  ThingSpeak.setField(3, var3);
  ThingSpeak.setField(4, var4);
  ThingSpeak.setField(5, var5);
  ThingSpeak.setField(6, var6);
  ThingSpeak.writeFields(ChannelNumber, WriteAPIKey);

Anyone see anything like this? Is it flakey server code?

May 19, 2017
9:48 am
Avatar
JasonW

MathWorks
Members
Forum Posts: 28
Member Since:
October 21, 2016
sp_UserOfflineSmall Offline

Both ThingSpeak and the library support writing all 8 fields at once.  To be sure, I just confirmed it with a sketch running on a MKR1000.  

I can also make it work with a URL in my browser:
https://api.thingspeak.com/update?api_key=INSERTAPIKEYHERE&field1=1&field2=2&field3=3&field4=4&field5=5&field6=6&field7=7&field8=8

It is possible your device is running out of RAM and causing the HTTP output buffer to get corrupted.  That would explain the null response.  Most of the early arduino device models don't have much RAM to begin with.  It is very easy to run out of RAM and not realize it.

May 23, 2017
8:34 pm
Avatar
JK
New Member
Members
Forum Posts: 2
Member Since:
May 19, 2017
sp_UserOfflineSmall Offline

Thanks for the tip. I am running low on RAM. Are there any good libs (or tricks) out there that provide memory resource tracking?

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
17 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

josephrj11, dennis55, jillhp4, tabathawg69, MarinaMa, Susandom

Administrators: Hans: 387, lee: 457