Hello Cayenne Community! This is the first post from a dual-beginner (new to both Arduino and Cayenne) – oh boy.
I have the basics pretty much down. Software is installed. Everything is talking. Cayenne is firing my outputs just fine (very interesting!) and everything I need to have physically wired up is wired and working. All good so far.
BUT I’m confused by one thing: I can’t seem to find any examples showing how to get the rest of the code in my Arduino sketch to be aware when Cayenne turns on (or off) one of the Arduino outputs.
What I’m trying to do is a remote 3-valve control solution for a friend’s ranch. I have my Arduino successfully connected to Cayenne and a set of relays are wired up and firing just great. What I’m trying to do is add some conditions that are pretty simple:
- Whenever Valve A or Valve B is commanded ON from Cayenne, Valve C must shut OFF.
- Whenever Valve C is commanded ON from Cayenne, valves A and B must both shut OFF.
And that’s it. [Outputs: Valve A = pin 5; B = pin 6; and C = pin 7]
There does not seem to be any easy way to do it with triggers without them stepping on each other (but I know I’m a huge rookie and that actually may be the easiest way.)
If I could understand how to make the rest of the code in the Arduino sketch detect and respond to the rising trigger (event) from Cayenne to turn on (or turn off) an output, then all would be good. I’m reasonably sure I could write that code, but I just haven’t been able to find an example to follow showing how to detect and act on a change of output sent via Cayenne.
Any help offered to solve this would be greatly appreciated!