I can’t get anything up on cosm.
I have set up three feeds in cosm - 0,1,2 which I guess is required to match the dataout section of the code. All of them display “This datestream has no datapoints yet”.
I am using the Pachube_ERX libaray. The code is the included example for Data out by Jeffrey Sun.
I have added my API_Key and FEED_ID. No other changes have been made, the sketch compiles kosher, and screen shows what I would expect to see.
The lines
#include <Arduino.h>
#include <HardwareSerial.h>
show all black, and the sketch will compile if I delete them. I have never seen them before, and I assume Arduino v1.0.1 doesn’t need them. The screen shows the analogue read as 1023. I have no idea what this is about, or how it is derived. I assume it is just a number, and anything will do at this stage, just so long as it gets into cosm.
I understand that the terms Pachube and cosm are interchangeable and I don’t need to edit the library. I am using the Freetronics EtherTen. It is connected to my router, I see the lights I would expect to see, and I have used it successfully on my LAN.
Here is the code. I would be glad of any comment.
/*
Pachube Data Out
Push local sensor data to Pachube server.
If you don't have a Pachube account, register one first (http://www.pachube.com/).
* Created 22 April 2011
* By Jeffrey Sun
* http://code.google.com/p/pachubelibrary/
*/
#include <Arduino.h>
#include <HardwareSerial.h>
#include <ERxPachube.h>
#include <Ethernet.h>
#include <SPI.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEE }; // make sure this is unique on your network
byte ip[] = { 192,168,0,193 }; // no DHCP so we set our own IP address
#define PACHUBE_API_KEY "3xj........bz0g" // fill in your API key PACHUBE_API_KEY
#define PACHUBE_FEED_ID "82012" // fill in your feed id
ERxPachubeDataOut dataout(PACHUBE_API_KEY, PACHUBE_FEED_ID);
void PrintDataStream(const ERxPachube& pachube);
void setup() {
Serial.begin(9600);
Ethernet.begin(mac, ip);
dataout.addData(0);
dataout.addData(1);
dataout.addData(2);
}
void loop() {
Serial.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
float fSensorData = 15.23;
dataout.updateData(0, analogRead(0));
dataout.updateData(1, fSensorData);
dataout.updateData(2, "Arduino Data");
int status = dataout.updatePachube();
Serial.print("sync status code <OK == 200> => ");
Serial.println(status);
PrintDataStream(dataout);
delay(5000);
}
void PrintDataStream(const ERxPachube& pachube)
{
unsigned int count = pachube.countDatastreams();
Serial.print("data count=> ");
Serial.println(count);
Serial.println("<id>,<value>");
for(unsigned int i = 0; i < count; i++)
{
Serial.print(pachube.getIdByIndex(i));
Serial.print(",");
Serial.print(pachube.getValueByIndex(i));
Serial.println();
}
}
Thank you