For Ryan or Travis:
I am still learning C++ (but have made some considerable progress and have signed up for a local college course in same). But it is not yet clear to me how to continuously monitor the value of a variable while the code is doing all of its other stuff.
Here’s what I want to do: every time the firmware on the Electron at the well receives an inbound event from the Election at the tank (Serial.println(“IO Event Received”);), set a dedicated variable to 0 (zero) and then start incrementing that variable every couple of minutes continuously until a new incoming event arrives from the tank. If the variable’s value should ever reach, let’s say, 10 minutes (no message from the tank for 10 minutes), publish a new event, e.g. “DISCONNECTED” or “NO RESPONSE” that can be sent via an IFTTT applet as a text or email to those responsible for monitoring the system.
Obviously, I cannot let the firmware execute in a ‘while’ loop continuously if doing so precludes the manual on/off control functions from being called (would it?).
If this is do-able, then I might expand upon the idea by having the Electron at the well send periodic events to the tank too. The latter would have the same capability to report a link failure. This way, no matter which end loses its cellular connectivity or power (assuming they don’t both do so at the same time), notification would be received.
Any ideas how to do this would be appreciated.
P.S.: how do my two Electrons know about each other, i.e. the firmware running on the Electron at the tank doesn’t have any addressing statement that identifies where its events should be sent. It must be done in the Particle Cloud but if so, then by implication every message sent by one Electron would be automatically delivered to every other device associated with the same account, right?