Hey guys, I am trying to make a project that utilizes the data returned from this API https://stationstream.space/api/isssolar/latest using an Arduino Yun.
I am very new to Yun and coding for retrieving internet data, also it is in JSON format, so I think I need to add a JSON library. All the examples I found use sample data and don't actually get anything from the internet. I could use some guidance for retrieving the information in the first place.
So far I've been trying to use the HttpClient example but I really have no idea what I'm doing and could use some help. This code doesn't compile, but even if I get it to compile I'm pretty sure it won't work. I'm using the arduinoJSON library example for JSON parsing. Any help would be greatly appreciated.
#include <Bridge.h>
#include <HttpClient.h>
#include <ArduinoJson.h>
void setup()
{
HttpClient client;
Serial.begin(9600);
while (!Serial) {
// wait serial port initialization
}
client.get("https://stationstream.space/api/isssolar/latest");
StaticJsonBuffer<200> jsonBuffer;
char json[] = client.read();
JsonObject& root = jsonBuffer.parseObject(json);
// Test if parsing succeeds.
if (!root.success()) {
Serial.println("parseObject() failed");
return;
}
const char* a = root["status"];
const char* b= root["voltage"];
// Print values.
Serial.println(a);
}
void loop()
{
}