3:57 pm

June 27, 2014

I began looking at the Arduino with Ethernet shield (http://community.thingspeak.com/tutorials/arduino/using-an-arduino-ethernet-shield-to-update-a-thingspeak-channel/) and adapted that to work with the Spark Core. Everything looks to be in order and I connect to the api address but fail to update it each time. Since code pastes seem to look like Poo on this forum I posted my code here:
http://community.thingspeak.com/tutorials/arduino/using-an-arduino-ethernet-shield-to-update-a-thingspeak-channel/
and the Serial output of the debugging is below, you can see I get a -1 back after sending what I think is a properly formatted update. Any thoughts would be appreciated. Once I get this running I plan to write up a tutorial on this.
=== Starting ===
-Network SSID: redacted
-Local IP: 172.17.2.271
-Link to view streamed data: https://thingspeak.com/channels/14187
.Connected to Spark Cloud
...Attempting to read the DHT22 sensor..Acquired
.DHT22 read successfully
-Temp oF: 71.06
-Humidity: 41.60
-Data String: field1=71.06&field2=41.60
-Data String Length: 25
...Attempting to update Thingspeak
...Connection succesful, updating datastreams
.Failure from Thingspeak
-Client Read: -1
9:19 am

June 27, 2014

I sure did, silly copy and paste. Here is the code as it stands.
https://github.com/rainierez/SparkCore/blob/master/Spark2Thingspeak.ino
I'll try changing it to client.println(tsData); and report back later. I have a ton of meetings this morning. :/ thanks for the input though
3:23 pm

June 27, 2014

That may have helped, but what is 100% necessary is to put a slight delay after the client.print statements before you proceed to the client.close. I found a delay of 100 usually works and knocks out the sporadic.
client.print("POST /update HTTP/1.1
");
client.print("Host: api.thingspeak.com
");
client.print("Connection: close
");
client.print("X-THINGSPEAKAPIKEY: "+writeAPIKey+"
");
client.print("Content-Type: application/x-www-form-urlencoded
");
client.print("Content-Length: ");
client.print(tsData.length());
client.print("
");
client.println(tsData);
delay(100);
Most Users Ever Online: 166
Currently Online:
23 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
rw950431: 272
Vinod: 240
piajola: 95
turgo: 70
vespapierre: 63
Adarsh_Murthy: 62
Member Stats:
Guest Posters: 1
Members: 8665
Moderators: 1
Admins: 2
Forum Stats:
Groups: 3
Forums: 14
Topics: 1600
Posts: 5760
Newest Members:
techhhelp5, ken, tran, huldacormier, bogart, estebanmateo93Moderators: cstapels: 460
Administrators: Hans: 405, lee: 457