Spark Core + Plotly

Argh. So I’ve adjusted code in a variety of ways, only to have it locked up at the serial output of:

Entering initial setup
... Attempting to connect to plotly's REST servers
... Connected to plotly's REST servers
... Sending HTTP Post to plotly

I’m at a loss – I’ve edited the library to include some output, but see nothing after the above line. I’ve also noted that I see an updated entry in my Plotly Workspace. So I see FileName(##), where ## iterates each time I reboot the Core. However, the new Plotly file is always empty. No idea why I can’t see the print line ouput below, after the “…Sending HTTP post to plotly”… edited library code below:

 if(log_level < 3){} Serial.println(F("... Connected to plotly's REST servers"));
    if(log_level < 3){} Serial.println(F("... Sending HTTP Post to plotly"));
    Serial.println("Prepping for POST /clinetresp");
    print_(F("POST /clientresp HTTP/1.1\r\n"));
    Serial.println("Prepping for Host: 107.21.214.199");
    print_(F("Host: 107.21.214.199\r\n")); 
    Serial.println("Prepping for User-Agent: SparkCore...");

Any ideas on how I can troubleshoot this one? Previously posted code has been updated to reflect the latest. I feel like I’m close… isn’t that how all prgramming projects go, you spend 95% of your time on the last 5%??? :confounded:

I had some trouble using this library, one of the problems being the while loop construction, which I also had to fix (in a bit different manner though) as it was causing my Photon to drop out of the cloud with the stuck loop.

Now a bigger issue was that I always got a negative response from plot.ly's server to the initialization: it complained about all of the params missing although they were supposed to have been sent. After dabbling with Postman a little bit I figured that I had to include the Content-type header for the request to pass:

print_(F("Content-Type: application/x-www-form-urlencoded\r\n"));

Now streaming seems to work perfectly. Hope this helps someone.

1 Like