Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By NHoff
#45412 Hey guys, so I'm trying to use an esp8266 (WemosD1 module) in arduino and read data from a thingspeak page and act on the info gathered. I'm using this code here: [ http://pastebin.com/LJndYZTf ]to try and read the results in field 1 and 2 and I'm getting all of this: [ http://pastebin.com/DTHN3RtP] in my serial monitor. Can anyone help me to only get field 1 and 2 and then how to use the values to have the module take action? I feel like there's an easy fix to this but I'm pretty new to arduino/esp8266 still.

If it helps to see the format of the information on the website, it's here: [ http://api.thingspeak.com/channels/103752/feeds/last]

I looked at putting it into JSON but I'm having trouble operating that as well. This is my code trying to integrate JSON : [ http://pastebin.com/VE97HND3] and I keep getting an error of

"call of overloaded 'parseArray(char&)' is ambiguous" at the line

"JsonArray& root = jsonBuffer.parseArray(json);"

The end goal of this is that I could have actions take place depending on the values of field 1 and field 2.

I'm sorry if this is the wrong board to post this question in, I'm new but desperate for an answer for this currently.
User avatar
By martinayotte
#45432 The first part of the HTTP response is theHTTP header, you first need to get rid of it, simply by throwing any lines received until the first empty line. Then, you need to concatenate any other lines into a single string before passing to the jsonBuffer.parseArray(str); .
User avatar
By NHoff
#45448 @martinayotte

Do you know of any quick tutorials of how to accomplish that? I'm sorry, I'm very new to Arduino in general and I can't think of how to throw out the lines before the empty line, unless it's some variant of an if/for/while loop.

@bbx10node

Yeah, I tried the ThingSpeak library initially but it sadly is for wifi shields or the Yun. I emailed thingspeak and they gave me an example code for posting data, but I've had a hard time finding ways to retrieve data.