First delete the widgets from the dashboard. try this code:
// This Arduino sketch reads DS18B20 "1-Wire" digital
// temperature sensors.
// Copyright (c) 2010 Mark McComb, hacktronics LLC
// License: http://www.opensource.org/licenses/mit-license.php (Go crazy)
// Tutorial:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-tutorial.html
#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <CayenneMQTTEthernet.h>
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "MQTT_USERNAME";
char password[] = "MQTT_PASSWORD";
char clientID[] = "CLIENT_ID";
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into pin 3 on the Arduino
#define ONE_WIRE_BUS 3
#define VIRTUAL_CHANNEL_1 1
#define VIRTUAL_CHANNEL_2 2
#define VIRTUAL_CHANNEL_3 3
#define VIRTUAL_CHANNEL_4 4
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// Assign the unique addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html
DeviceAddress ColdStorage1Thermometer = { 0x28, 0xFF, 0xAC, 0xCF, 0x02, 0x17, 0x04, 0x55 };
DeviceAddress CooldStorage2Thermometer = { 0x28, 0xFF, 0x6E, 0xED, 0x02, 0x17, 0x03, 0x00 };
DeviceAddress ColdStorage3Thermometer = { 0X28, 0xFF, 0x34, 0x58, 0x02, 0x17, 0x05, 0xE5 };
DeviceAddress GH1Thermometer = { 0x28 , 0xFF, 0xA2, 0xCD, 0x02, 0x17, 0x03, 0x73 };
void setup(void)
{
// start serial port
Serial.begin(9600);
Cayenne.begin(username, password, clientID);
// Start up the library
sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution( ColdStorage1Thermometer, 10);
sensors.setResolution( CooldStorage2Thermometer, 10);
sensors.setResolution(ColdStorage3Thermometer, 10);
sensors.setResolution(GH1Thermometer, 10);
}
void loop(void)
{
Cayenne.loop();
}
CAYENNE_OUT_DEFAULT()
{
float tempC1 = sensors.getTempC(ColdStorage1Thermometer);
if (tempC1 == -127.00) {
Serial.print("Error getting temperature");
} else {
Serial.print("C: ");
Serial.print(tempC1);
Cayenne.celsiusWrite(VIRTUAL_CHANNEL_1, tempC1);
}
float tempC2 = sensors.getTempC(CooldStorage2Thermometer);
if (tempC2 == -127.00) {
Serial.print("Error getting temperature");
} else {
Serial.print("C: ");
Serial.print(tempC2);
Cayenne.celsiusWrite(VIRTUAL_CHANNEL_2, tempC2);
}
float tempC3 = sensors.getTempC(ColdStorage3Thermometer);
if (tempC3 == -127.00) {
Serial.print("Error getting temperature");
} else {
Serial.print("C: ");
Serial.print(tempC3);
Cayenne.celsiusWrite(VIRTUAL_CHANNEL_3, tempC3);
}
float tempC4 = sensors.getTempC(GH1Thermometer);
if (tempC4 == -127.00) {
Serial.print("Error getting temperature");
} else {
Serial.print("C: ");
Serial.print(tempC4);
Cayenne.celsiusWrite(VIRTUAL_CHANNEL_4, tempC4);
}
}
This should auto add new green temporary widgets to your dashboard. Add them by clicking +