I cannot upload data from my Arduino Mega with Ethernet Shiled to Cosm. I tried one of the tutorial examples (DatastreamUpload.ino
). I used the API key and feed ID that Cosm gave to me at the registration and changed the init()
function to use a static IP address as below:
byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0xD3, 0x45 };
IPAddress ip(192,168,0, 110);
IPAddress gateway(192,168,0, 1);
IPAddress subnet(255, 255, 255, 0);
then:
Ethernet.begin(mac, ip, gateway, subnet);
Here is the output from serial monitor:
Read sensor value 452.00 Uploading it to Cosm cosmclient.put returned -1 Read sensor value 451.00 Uploading it to Cosm cosmclient.put returned -1 Read sensor value 378.00 Uploading it to Cosm cosmclient.put returned -3 Read sensor value 352.00 Uploading it to Cosm cosmclient.put returned -3
Does someone have a solution to this?
Unsurprisingly, the ino you link to looks 100% kosher and I struggle to see anything different from what I have used.
As a precaution I would put int ret=0; at the start of the loop
I realise you have only one sensor but suggest you meticulously identify it as sensorId0
I have a buffer
const int bufferSize = 100; char bufferValue[bufferSize]; CosmDatastream datastreams[] = { CosmDatastream(sensorId0, strlen(sensorId0), DATASTREAM_FLOAT),
The full bottle was published on the cosm forum last October.
I don't use that ip, gateway and subnet stuff. It is probably muddying the water.