I am new to the Particle products and coding in general. I am using the Echo Photon Bridge:
https://github.com/JeremyProffitt/EchoPhotonBridge. I am using this for a lighting project and have managed to get on/off and light percentage to work fine using voice commands with Alexa. I am lost when trying to figure out to get Alexa to change the LED colors. She always says that my LEDs won’t do that. My LED’s are generic 12V RGB common anode units. My electronic circuit is good and has been tested, I’m just not able to work out the code. The example code with the project just shows some code for use with the FastLED library and harware. Any ideas/comments would be welcome.
Thank you,
troutbumoh
My code so far:
// This #include statement was automatically added by the Particle IDE.
#include <EchoPhotonBridge.h>
// This #include statement was automatically added by the Particle IDE.
#include "EchoPhotonBridge.h"
EchoPhotonBridge epb;
#define redPin D0
#define greenPin D1
#define bluePin D2
void setup()
{
pinMode(redPin, OUTPUT);
analogWrite(redPin, 0, 255);
pinMode(greenPin, OUTPUT);
analogWrite(greenPin, 0, 255);
pinMode(bluePin, OUTPUT);
analogWrite(bluePin, 0, 255);
String deviceName = "Desk LEDs";
epb.addEchoDeviceV2OnOff(deviceName, &functionOnOff);
epb.addEchoDeviceV2Percent(deviceName, &functionPercent);
}
int functionOnOff(int device, bool onOff, String rawParameters)
{
analogWrite(redPin, (onOff) ? 255 : 0, 255);
analogWrite(greenPin, (onOff) ? 255 : 0, 255);
analogWrite(bluePin, (onOff) ? 255 : 0, 255);
}
int functionPercent(int device, int percent, int changeAmount, String rawParameters)
{
analogWrite(redPin, percent * 1, 255);
analogWrite(greenPin, percent * 1, 255);
analogWrite(bluePin, percent * 1, 255);
}
int functionColor(int device, int R, int G, int B, String rawParameters)
{
analogWrite(redPin, R);
analogWrite(greenPin, G);
analogWrite(bluePin, B);
}
void loop()
{
}