Hello everyone.
I have an Arduino connected to Cayenne platform.
Is working well , I can control the lamps in my house perfectly.
I would like to add a physical switch for lamps , working independently .
I’m having trouble writing the code , could someone help me?
Thank you in advance to all of this community.
My Code
_include "CayenneDefines.h"_
_include "BlynkSimpleEsp8266.h"_
_include "CayenneWiFiClient.h"_
include <Wire.h>
int LAMP = D2;
char token = “token”;
char ssid = “ssid”;
char password = “pass”;
void setup()
{
pinMode(LAMP, OUTPUT);
Serial.begin(921600);
Cayenne.begin(token, ssid, password);
}
CAYENNE_IN(V1)
{
int currentValue = getValue.asInt(); // 0 to 1
if (currentValue == 0) {
digitalWrite(LAMP, HIGH);
} else {
digitalWrite(LAMP, LOW);
}
void loop()
{
Cayenne.run();
}