#define CAYENNE_PRINT Serial #include <CayenneMQTTESP8266.h> // WiFi network info. char ssid[] = "ssid"; char wifiPassword[] = "wifiPassword"; // Cayenne authentication info. This should be obtained from the Cayenne Dashboard. char username[] = "MQTT_USERNAME"; char password[] = "MQTT_PASSWORD"; char clientID[] = "CLIENT_ID"; unsigned long lastMillis = 0; void setup() { Serial.begin(9600); Cayenne.begin(username, password, clientID, ssid, wifiPassword); } void loop() { Cayenne.loop(); //Cayenne input function from channel 7 on dashboard CAYENNE_IN(7) { int currentValue = getValue.asInt(); if (currentValue == 1) { //turn light on when you turn on the button on cayenne dashboard digitalWrite(D6, HIGH); } else { //turn light off you turn off the button on cayenne dashboard digitalWrite(D6, LOW); } } }