#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneMQTTEthernet.h>
#include <Ethernet.h>
#include <dht.h>
char username [] = "ce" ;
char password [] = "aaa94d" ;
char clientID [] = "6caf" ;
#define SENSOR_PIN 0
#define VIRTUAL_CHANNEL 1
int outPin = 13;
#define dht_dpin A1 //Pino DATA do Sensor ligado na porta Analogica A1
dht DHT; //Inicializa o sensor
void setup()
{
pinMode (outPin,OUTPUT );
Serial.begin(9600);
delay(1000);//Aguarda 1 seg antes de acessar as informações do sensor
Cayenne.begin(username, password, clientID);
}
void loop()
{
DHT.read11(dht_dpin); //Lê as informações do sensor
Serial.print("Umidade = ");
Serial.print(DHT.humidity);
Serial.print(" % ");
Serial.print("Temperatura = ");
Serial.print(DHT.temperature);
Serial.println(" Celsius ");
if (DHT.temperature>30)
{
digitalWrite(outPin, HIGH);
}
else
{
digitalWrite(outPin, LOW);
}
Cayenne.loop();
}
// This function is called at intervals to send sensor data to Cayenne.
CAYENNE_OUT(VIRTUAL_CHANNEL)
{
Cayenne.virtualWrite(VIRTUAL_CHANNEL, analogRead(SENSOR_PIN));
}
add #define CAYENNE_DEBUG
in your code and check the issue in your serial monitor.