Pls help me on COSM (I am new thx!)

Hi guys
I am new to arduino and COSM and I got some troubles on my work

I am using Arduino UNO and RN-131C by sparksfun

I have created a COSM account and I got API Key and Feed

I am using the example to try out my project
However, I can't find any data uploaded to my COSM

I have checked the connections of WiFi is okay and I have used wifi tester to confirm my connection

So what should I do first to check the problem?

Many Thanks !

this is my code thx

#include SPI.h
#include WiFi.h
#include HttpClient.h
#include Cosm.h

char ssid[] = "fyp2013"; // your network SSID (name)
char pass[] = "2496054321"; // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0; // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;

// Your Cosm key to let you upload data
char cosmKey[] = "oZy9HnWvWl1i3CRtl4mSeR2JASaSAKxuNkplczZtMElsMD0g";

// Analog pin which we're monitoring (0 and 1 are used by the Ethernet shield)
int sensorPin = 2;

// Define the strings for our datastream IDs
char sensorId[] = "sensor_reading";
CosmDatastream datastreams[] = {
CosmDatastream(sensorId, strlen(sensorId), DATASTREAM_FLOAT),
};
// Finally, wrap the datastreams into a feed
CosmFeed feed(120202, datastreams, 1 /* number of datastreams */);

WiFiClient client;
CosmClient cosmclient(client);

void printWifiStatus() {
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());

// print your WiFi shield's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);

// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);

Serial.println("Starting single datastream upload to Cosm...");
Serial.println();

// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}
Serial.println("Connected to wifi");
printWifiStatus();
}

void loop() {
int sensorValue = analogRead(sensorPin);
datastreams[0].setFloat(sensorValue);

Serial.print("Read sensor value ");
Serial.println(datastreams[0].getFloat());

Serial.println("Uploading it to Cosm");
int ret = cosmclient.put(feed, cosmKey);
Serial.print("cosmclient.put returned ");
Serial.println(ret);

Serial.println();
delay(15000);
}

Hi,

Are you seeing readings from your sensor on your Serial monitor?

Geoff

I assume you don't see any data on the serial monitor. If the signal is on A2, this is not pin 2. Try

int sensorPin = 16;

I don't know anything about WiFi but the basic cosm commands look pretty kosher but, just in case, try more rigorous identification of the sensor

CosmDatastream(sensorId0, strlen(sensorId0), DATASTREAM_FLOAT),