When does the code jump into the CAYENNE_OUT_DEFAULT() and CAYENNE_IN() functions?
Also, do they happen sequentially?
Is it possible to jump to these functions from my main loop so they can happen when I want them to? I am looking to have more control over when they are called.
this function is called automatically when you use the cayenne dashboard to send value to your device.
in case of CAYENNE_OUT_DEFAULT() you can use inbuilt millis() to send data at your own time intervals. but it should not be sent at higher rate as it could cause your device to disconnect.
Currently CAYENNE_OUT_DEFAULT() is called every 15 seconds. CAYENNE_IN() is called whenever a new message is received from the server. So if by “happen sequentially” you mean are they always called in succession, no. The CAYENNE_IN() function only executes when it gets a message, not every 15 seconds.
If you want more control over calling them there are a few options. One is to make a helper function to do the work, and then have both CAYENNE_OUT_DEFAULT() and your main loop call that. Another is to just send data from the main loop as described by item #2 in the link shramiksalgaonkar posted.
A third way would be to use the poll-interval branch of the Arduino library which adds support for specifying the interval that CAYENNE_OUT functions are called via a parameter to Cayenne.loop. Though that code is untested so it could have issues. Also, you have to be careful not to send data at very short intervals since it could cause your device to be limited or blocked.
@jburhenn or @shramik_salgaonkar where does the Cayenne.loop() statement call to? Is this where the CAYENNE_OUT function is called? Where can I learn more about the parameter type to the Cayenne.loop() statement?