Hi.
I am new to Cayenne Community.
I want to control an RGB with 3 slide bars, one per color. My problem is that I am not able to send the information from the slide bar to arduino.
I can swich on a Led with a button from cayenne, but cannot go any further.
Could anybody help me with the steps I have to follow, please?
Thank you in advance
My code:
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneMQTTESP8266Shield.h>
// WiFi network info.
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
// Set ESP8266 Serial object. In this example we use the Serial1 hardware serial which is available on boards like the Arduino Mega.
#define EspSerial Serial2
ESP8266 wifi(&EspSerial);
#define VirtualRED 11
#define VirtualGREEN 10
#define VirtualBLUE 9
#define RED 11
#define GREEN 10
#define BLUE 9
#define LEDPin 2
#define PIRPin 7
#define Piso1 7
unsigned long TapagadoPIR;
unsigned long tiempoPIR = 8000;
unsigned long Tserial = 0;
int rojo;
int verde;
int azul;
void setup()
{
Serial.begin (9600);
delay(10);
EspSerial.begin(115200);
delay(10);
pinMode(LEDPin, OUTPUT);
pinMode(RED, OUTPUT);
pinMode(GREEN, OUTPUT);
pinMode(BLUE, OUTPUT);
Cayenne.begin(username, password, clientID, wifi, ssid, wifiPassword);
}
void loop()
{
int valuePIR= digitalRead(PIRPin);
Cayenne.loop();
analogWrite(RED, rojo);
}
CAYENNE_IN(VirtualRED)
{
rojo = getValue.asInt();
CAYENNE_LOG("Channel %d, value %d", VirtualRED, rojo);
}