Hello fammagg,
Try this
This is the basic skeleton … millis and led command … add it what you need
//#define CAYENNE_DEBUG
//#define CAYENNE_PRINT Serial
#include <ESP8266WiFi.h>
#include <CayenneMQTTESP8266.h>
char ssid = “ssid”;
char wifiPassword = “wifipassword”;
// Cayenne authentication info.
char username = “username”;
char password = “password”;
char clientID = “ClientID”;
unsigned long lastMillis = 0;
void setup()
{
Serial.begin(115200);
pinMode(D0, OUTPUT);
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
}
void loop()
{
Cayenne.loop();
if (millis() - lastMillis > 10000)
{
lastMillis = millis();
Cayenne.virtualWrite(0, lastMillis);
}
}
CAYENNE_IN(1) // Led command
{
int currentValue = getValue.asInt();
if (currentValue == 1)
{
digitalWrite(D0, HIGH);
}
else
{
digitalWrite(D0, LOW);
}
}
CAYENNE_IN_DEFAULT()
{
CAYENNE_LOG(“CAYENNE_IN_DEFAULT(%u) - %s, %s”, request.channel, getValue.getId(), getValue.asString());
}
Salutations.