Detecting when Arduino connects to Cayenne

Hi all,

Maybe a noob question: how can I check in the Arduino sketch if it had connected to the Cayenne? I know it prints that to the serial, but I wanted to have an LED start blinking after the board comes online at mydevices.com

Any ideas? Thanks in advance.

I just learned how I can achieve this using Triggers from within Cayenne.

But I have a problem, I set up two triggers, one for when it comes online, and one for when it goes offline. Now after reseting to board, the light switch that it’s connected to in Cayenne dashboard comes online, the LED on the Arduino lights up, but it after a second it goes off. The light switch on the dashboard on the other hand stays on.

Can you post your sketch? I can’t think of anything that would make that happen.

I would like to achieve a similar result… How did you detect the connection between the board and cayenne?

you can use cayenne trigger feature to notify you with a text message.

*note : there is a bug with trigger engine right now.

I meant the code used to light the LED if connected

i use this with ESP8266 (Arduino IDE) try if working for you ?

// This function will run every time the Cayenne connection is established.
CAYENNE_CONNECTED()
{
  CAYENNE_LOG("Connection established");
  Serial.println("\n++ Cayenne Connected ! ++"); // can be deleted
//<==== HERE i do something when Cayenne is connected 
 }
CAYENNE_DISCONNECTED()
{
  CAYENNE_LOG("Connection finished");
  Serial.println("\n--  Cayenne Disconnected ! --");    //  can be deleted
//<==== HERE i do something when Cayenne is disconnected  
}
1 Like

Thank you. Will give it a go