Thingspeak and mbed | ThingSpeak Projects | Forum


Please consider registering


— Forum Scope —

— Match —

— Forum Options —

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

Register Lost password?
sp_Feed sp_TopicIcon
Thingspeak and mbed

Forum Posts: 7
sp_UserOfflineSmall Offline
March 10, 2014 - 4:42 am
sp_Permalink sp_Print

Dear all,

I am using an mbed NXP LPC1768 to upload data to a thingspeak channel and everything works fine, but if I try to read data from a channel I got into problems, maybe someone can help...since I don't have to much background on the subject.

this is how I build the data to send over http to thingspeak, where:

- thingSpeakUrl is the following string: ""
- thingSpeakKey is the Thingspeak write API key of my channel
- test_data is a random data of float type...(let's say temperature)

sprintf( urlBuffer, "%s?key=%s&field1=%f", thingSpeakUrl, thingSpeakKey, test_data);

this is how data is sent to thingspeak
HTTPResult res = http.get(urlBuffer, str, 128);

The problem is that i don't know how to read data back or where I can find or extract it.

- thingSpeakUrl_read is the following string: ""
- thingSpeakKey_read is the Thingspeak read API key of my channel
- read_data is a float type data.
sprintf(url_read_Buffer, "%s?key=%s%f=&field1", thingSpeakUrl_read, thingSpeakKey_read, read_data);

Sorry for the long post.
Please let me know if you have any ideea.



Forum Posts: 7
sp_UserOfflineSmall Offline
March 10, 2014 - 5:20 am
sp_Permalink sp_Print

Dear all,

I solved the issue, the problem was the way I was building the request...after reading the API documentation more carefully.
Bellow there is the way it worked:

sprintf(url_read_Buffer, "%s?key=%s", thingSpeakUrl_read, thingSpeakKey_read);
HTTPResult res_2 = http.get(url_read_Buffer, str2,128);

where str2 is a string with a length of 512.

The response comes under the JSON format (a little bit of string processing will deal with data value extraction):
"created_at": "2014-02-26T21:27:21Z",
"entry_id": 144,
"field1": "28.5",

Nevertheless, when I was reading the API documentation I was thinking ... what in the world is this...but actually is really simple.

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
26 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:







Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565


Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee