arduino - Cannot upload data get xivelyclient.put returned -1 -


background: trying upload data simple on off sensor learn xively methods. using arduino uno wifi shield. made simple alterations example sketch xively library keep simple. have read documentation , faq's plus searched web. there similar question (can't connect xively using arduino + wifi shield, "ret = -1 no sockets available) , answer reduce number of libraries loaded. i'm using same library list recommended in post.i have updated arduino ide , downloaded latest xively , http library. code compiles without error. re-loaded device on xively website , got new api key , number well. plus, ensured channel added correct sensor name. have checked router , ensured wifi shield connecting properly.

problem: can't see data on xively website , keep getting following error messages on serial monitor arduino:

xivelyclint.put returned -1

also, after several tries, "no socket available"

question: there problem code or else?

current arduino code (actual ssid, password , api key , number removed):

#include <spi.h> #include <wifi.h> #include <httpclient.h> #include <xively.h>  char ssid[] = "ssid"; //  network ssid (name)  char pass[] = "password";    // network password (use wpa, or use key wep) int keyindex = 0;            // network key index number (needed wep)  int status = wl_idle_status;  // xively key let upload data char xivelykey[] = "api_key";  // analog pin we're monitoring (0 , 1 used ethernet shield) int sensorpin = 2;  // define strings our datastream ids char sensorid[] = "sensor_id"; xivelydatastream datastreams[] = {   xivelydatastream(sensorid, strlen(sensorid), datastream_int), }; // finally, wrap datastreams feed xivelyfeed feed(feed no., datastreams, 1 /* number of datastreams */);  wificlient client; xivelyclient xivelyclient(client);  void printwifistatus() {   // print ssid of network you're attached to:   serial.print("ssid: ");   serial.println(wifi.ssid());    // print wifi shield's ip address:   ipaddress ip = wifi.localip();   serial.print("ip address: ");   serial.println(ip);    // print received signal strength:   long rssi = wifi.rssi();   serial.print("signal strength (rssi):");   serial.print(rssi);   serial.println(" dbm"); } void setup() {   // put setup code here, run once:   serial.begin(9600);    serial.println("starting single datastream upload xively...");   serial.println();    // attempt connect wifi network:   while ( status != wl_connected) {      serial.print("attempting connect ssid: ");     serial.println(ssid);     status = wifi.begin(ssid, pass);     // wait 10 seconds connection:     delay(10000);   }    serial.println("connected wifi");   printwifistatus(); }  void loop() {   int sensorvalue = digitalread(sensorpin);   datastreams[0].setint(sensorvalue);    serial.print("read sensor value ");   serial.println(datastreams[0].getint());    serial.println("uploading xively");   int ret = xivelyclient.put(feed, xivelykey);   serial.print("xivelyclient.put returned ");   serial.println(ret);    serial.println();   delay(15000); } 


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -