Having trouble with two of four temp sensors not dispaying accurate temp. Just show -197
the two that are working cant save triggers either dont save or appear to save but revert back to default. Using arduino uno with 18b20 temp sensors below is my code
// This example shows how to connect to Cayenne using an Ethernet W5500 shield and send/receive sample data.
//#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
//#include <CayenneMQTTEthernet.h>
#include <CayenneMQTTEthernetW5500.h>
#include <OneWire.h>
#include <DallasTemperature.h>
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "bd4a1000-a9d3-11e6-82ee-87310fcf8579";
char password[] = "bada44eda9a38dd862c5a1afc0809579a6d882a9";
char clientID[] = "09709a20-6a81-11e8-a76a-fdebb8d0010d";
unsigned long lastMillis = 0;
#define VIRTUAL_CHANNEL4 4
#define VIRTUAL_CHANNEL5 5
#define VIRTUAL_CHANNEL6 6
#define VIRTUAL_CHANNEL7 7
// Digital pin the DS18B20 is connected to. Do not use digital pins 0 or 1 since those conflict with the use of Serial.
const int tmpPin7 = 7;
const int tmpPin6 = 6;
const int tmpPin5 = 5;
const int tmpPin4 = 4;
OneWire oneWire7(tmpPin7);
OneWire oneWire6(tmpPin6);
OneWire oneWire5(tmpPin5 );
OneWire oneWire4(tmpPin4);
DallasTemperature sensors7(&oneWire7);
DallasTemperature sensors6(&oneWire6);
DallasTemperature sensors5(&oneWire5);
DallasTemperature sensors4(&oneWire4);
void setup()
{
Serial.begin(9600);
Cayenne.begin(username, password, clientID);
sensors4.begin();
sensors5.begin();
sensors6.begin();
sensors7.begin();
}
void loop()
{
Cayenne.loop();
}
CAYENNE_OUT(VIRTUAL_CHANNEL4)
{
// Send the command to get temperatures.
sensors4.requestTemperatures();
// This command writes the temperature in Celsius to the Virtual Channel.
//Cayenne.celsiusWrite(VIRTUAL_CHANNEL, sensors6.getTempCByIndex(0));
// To send the temperature in Fahrenheit use the corresponding code below.
Cayenne.fahrenheitWrite(VIRTUAL_CHANNEL4, sensors4.getTempFByIndex(0));
}
// This function is called at intervals to send sensor data to Cayenne.
CAYENNE_OUT(VIRTUAL_CHANNEL5)
{
// Send the command to get temperatures.
sensors5.requestTemperatures();
// This command writes the temperature in Celsius to the Virtual Channel.
//Cayenne.celsiusWrite(VIRTUAL_CHANNEL, sensors5.getTempCByIndex(0));
// To send the temperature in Fahrenheit use the corresponding code below.
Cayenne.fahrenheitWrite(VIRTUAL_CHANNEL5, sensors5.getTempFByIndex(0));
}
CAYENNE_OUT(VIRTUAL_CHANNEL6)
{
// Send the command to get temperatures.
sensors6.requestTemperatures();
// This command writes the temperature in Celsius to the Virtual Channel.
//Cayenne.celsiusWrite(VIRTUAL_CHANNEL, sensors6.getTempCByIndex(0));
// To send the temperature in Fahrenheit use the corresponding code below.
Cayenne.fahrenheitWrite(VIRTUAL_CHANNEL6, sensors6.getTempFByIndex(0));
}
CAYENNE_OUT(VIRTUAL_CHANNEL7)
{
// Send the command to get temperatures.
sensors7.requestTemperatures();
// This command writes the temperature in Celsius to the Virtual Channel.
//Cayenne.celsiusWrite(VIRTUAL_CHANNEL, sensors6.getTempCByIndex(0));
// To send the temperature in Fahrenheit use the corresponding code below.
Cayenne.fahrenheitWrite(VIRTUAL_CHANNEL7, sensors7.getTempFByIndex(0));
}