Cant Connect to REST servers
include <WiFi.h>
include "plotly_streaming_wifi.h"
// Sign up to plotly here: https://plot.ly // View your API key and streamtokens here: https://plot.ly/settings
define nTraces 2
// View your tokens here: https://plot.ly/settings // Supply as many tokens as data traces // e.g. if you want to ploty A0 and A1 vs time, supply two tokens char *tokens[nTraces] = {"xvkznhcwzl", "yzppqud6ay"}; // arguments: username, api key, streaming token, filename plotly graph = plotly("walkerbusby", "3vijh4c4fg", tokens, "test", nTraces);
int status = WL_IDLE_STATUS; // the Wifi radio's status char ssid[] = "mokie"; // your network SSID (name) char pass[] = "happiness1"; // // your network password
void wifi_connect(){ // attempt to connect using WPA2 encryption: Serial.println("... Attempting to connect to WPA network..."); status = WiFi.begin(ssid, pass); // if you're not connected, stop here: if ( status != WL_CONNECTED) { Serial.println("... Couldn't get a WiFi connection, trying again"); wifi_connect(); } // if you are connected, print out info about the connection: else { Serial.println("... Connected to network"); } }
void setup() {
// Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only }
wifi_connect();
graph.fileopt="overwrite"; // See the "Usage" section in https://github.com/plotly/arduino-api for details bool success; success = graph.init(); if(!success){while(true){}} graph.openStream(); }
unsigned long x; int y;
void loop() { graph.plot(millis(), analogRead(A0), tokens[0]); graph.plot(millis(), analogRead(A1), tokens[1]);
delay(200);
}
.connect to WPA network... ... Couldn't get a WiFi connection, trying again ... Attempting to connect to WPA network... ... Attempting to connect to WPA network... ... Couldn't get a WiFi connection, trying again ... Attempting to connect to WPA network... ... Connected to network ... Attempting to connect to plotly's REST servers ... Couldn't connect to plotly's REST servers... trying again! ... Couldn't connect to plotly's REST servers... trying again! ... Couldn't connect to plotly's REST servers... trying again! ... Couldn't connect to plotly's REST servers... trying again! No Socket available ... Couldn't connect to plotly's REST servers... trying again! No Socket available ... Couldn't connect to plotly's REST servers... trying again! this is what happens in the serial monitor
Yikes, thanks for reporting! Have you tried connecting to other services, i.e. pinging google?
It might be worth including some debugging-scripts in this repo that make simple POSTs to some other web-service, just to make sure that the problem is on Plotly's side and not the arduino's side!
Are you using the Arduino IDE version 1.0.3? WiFi has issues with >= 1.0.5
Yes.
Cheers,
Reid
On 5 Dec 2014, at 3:48 am, Alejandro [email protected] wrote:
Are you using the Arduino IDE version 1.0.3? WiFi has issues with >= 1.0.5
— Reply to this email directly or view it on GitHub.
I have this same issue with the example given. Is there any solution? I'm stuck. btw: Adafruit's build test sketch ping works perfectly for me but the plotly example cannot connect.
... Initializing... ... Connected! ... Request DHCP ... Attempting to connect to plotly's REST servers ... Couldn't connect to plotly's REST servers... trying again! ... Couldn't connect to plotly's REST servers... trying again! ... Couldn't connect to plotly's REST servers... trying again! ... Couldn't connect to plotly's REST servers... trying again! ... Couldn't connect to plotly's REST servers... trying again! ... Couldn't connect to plotly's REST servers... trying again! ... Couldn't connect to plotly's REST servers... trying again! ... Couldn't connect to plotly's REST servers... trying again! ----------------------------------code----------- #include <Adafruit_CC3000.h> #include <ccspi.h> #include <SPI.h> #include <plotly_streaming_cc3000.h>
#define WLAN_SSID "T_house" #define WLAN_PASS "xxxxxxx" #define WLAN_SECURITY WLAN_SEC_WPA2
// Sign up to plotly here: https://plot.ly // View your API key and streamtokens here: https://plot.ly/settings #define nTraces 2 // View your tokens here: https://plot.ly/settings // Supply as many tokens as data traces // e.g. if you want to ploty A0 and A1 vs time, supply two tokens char *tokens[nTraces] = {"bhg9b670cd", "kp7vqlgkks"}; // arguments: username, api key, streaming token, filename plotly graph = plotly("jimthomas47", "wvifii5y4b", tokens, "plotlyfilejt", nTraces);
void wifi_connect(){ /* Initialise the module */ Serial.println(F("\n... Initializing...")); if (!graph.cc3000.begin()) { Serial.println(F("... Couldn't begin()! Check your wiring?")); while(1); }
// Optional SSID scan // listSSIDResults();
if (!graph.cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) { Serial.println(F("Failed!")); while(1); }
Serial.println(F("... Connected!"));
/* Wait for DHCP to complete */ Serial.println(F("... Request DHCP")); while (!graph.cc3000.checkDHCP()) { delay(100); // ToDo: Insert a DHCP timeout! } }
void setup() {
// Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only }
wifi_connect();
graph.fileopt="overwrite"; // See the "Usage" section in https://github.com/plotly/arduino-api for details bool success; success = graph.init(); if(!success){while(true){}} graph.openStream(); }
unsigned long x; int y;
void loop() { graph.plot(millis(), analogRead(A0), tokens[0]); graph.plot(millis(), analogRead(A1), tokens[1]);
}
Hey All,
I have the same problem, any solutions found?
Regards, Maarten
me too, same problem // I put in the right API Key and everything else..
Has this been resolved ?