EchoPhotonBridge


#1

Hello All. I just did the example with the EchoPhotonBridge and Alexa.
It works great but I am unsure as to the coding to make a second led (like connected to pin D0) work.
I know this is simple but I’m not that good at coding.
Any thoughts/help would be appreciated!


#2

A link to what you’ve tried, and/or some code to look at would be helpful…


#3

That’s just it…I’m not sure what to try or how to add things. Do I have to edit the include files?
I simply followed the instructions for this to turn board led on/off and it works.


#4

You can define a second function, and associate it with another pin and another utterance.
“Alexa Turn on Photon LED” is the onboard LED
"Alexa Turn on light" sets pin D1 HIGH

#include <EchoPhotonBridge.h>

EchoPhotonBridge epb;

int functionOnOffD1(int device, bool onOff, String rawParameters) {
digitalWrite(D1, (onOff) ? HIGH : LOW);
}

int functionOnOffD7(int device, bool onOff, String rawParameters) {
digitalWrite(D7, (onOff) ? HIGH : LOW);
}

void setup() {
pinMode(D7, OUTPUT);
epb.addEchoDeviceV2OnOff("Photon LED", &functionOnOffD7);

pinMode(D1, OUTPUT);
epb.addEchoDeviceV2OnOff("Photon Light", &functionOnOffD1);

}

void loop() { }

#5

Perfect. I will play with that. Thank you!


#6

That’s the ticket. I also have to say “Alexa, discover devices” after any changes.
Thanks again!