Hi
New to ubidots and to arduino coding, but trying to learn.
Making a simple temperature logger for a meat aging fridge. Data is published to particle (correctly) and to ubidots, but the values in ubidots is consistent -127. It worked for a couple of minutes the first time I set up the service, but has since not worked.
This is the code:
#include <spark-dallas-temperature.h>
#include <OneWire.h>
#include <Ubidots.h>
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS D2
#define TOKEN "TOKEN" // Put here your Ubidots TOKEN
Ubidots ubidots(TOKEN);
/********************************************************************/
// Setup a oneWire instance to communicate with any OneWire devices
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
/********************************************************************/
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
/********************************************************************/
void setup(void)
{
// start serial port
Serial.begin(115200);
sensors.begin();
}
void loop(void)
{
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
sensors.requestTemperatures(); // Send the command to get temperature readings
float temp = sensors.getTempCByIndex(0);
Particle.publish("Temperature", String(temp), 1, PRIVATE);
ubidots.add("Temperature", temp);
ubidots.sendAll();
delay(30000);
}
Appreciate any help
BR
Jørgen