it comes with multiply errors when checking the code
i can find the correct order
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneMQTTESP8266.h>
// WiFi network info.
char ssid =
char wifiPassword =
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username =
char password =
char clientID =
#define VIRTUAL_CHANNEL 6
#define ACTUATOR_PIN 4 // Do not use digital pins 0 or 1 since those conflict with the use of Serial.
int ledPin = 2;
void setup()
{
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(ACTUATOR_PIN, OUTPUT);
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
int value = 0;
// constants won’t change. Used here to set a pin number:
const int ledPin = LED_BUILTIN;// the number of the LED pin
// Variables will change:
int ledState = LOW; // ledState used to set the LED
// Generally, you should use “unsigned long” for variables that hold time
// The value will quickly become too large for an int to store
unsigned long previousMillis = 0; // will store last time LED was updated
// constants won’t change:
const long interval = 1000;
}
void loop(){
if (value == 1)
{
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
if (ledState == LOW) {
ledState = HIGH;
} else {
ledState = LOW;
}
// set the LED with the ledState of the variable:
digitalWrite(ledPin, ledState);
}
}
}
// This function is called when data is sent from Cayenne.
CAYENNE_IN(VIRTUAL_CHANNEL)
{
value = getValue.asInt();