Hi. I am making an application that activates a relay and would like to detect when it has closed to make sure signals are disabled. It is possible?
I have observed that the sketch is sometimes closed by any error and the relay is active.
Thanks in advance.
Could you please explain your issue with some more detail? I'm a bit confused.
You mentioned that your application activates a relay and you would like to know when it's been closed to monitor some signals. Then you mention the sketch, is this the sketch that's controlling the relay activation? Why do you want to detect if the sketch has been closed? Is this to reopen it?
Any detail will be appreciated.
Hi Pablo. Thanks for the reply.
A scketch controls the on / off signal that activates or deactivates a solenoid irrigation.
This scketch has a problem (I try to solve) and sometimes stoped unexpectedly. When I check the active processes in the intel edison note that said scketch has been closed. In tests it has happened that have been active signals and scketch has been closed, the problem involved, the solenoid would remain open.
So I had thought if somehow I could detect whether a scketch closes and then look at the status of the signals. For security
Each time I open or close a solenoid write in a log file of the sd card. I could do another sketch to read the last line of the file and check if the solenoid is open and for how long. But if there is a problem reading / writing this log file was studying possibilities.
Is this sketch supposed to be closed at some point or it should be always running? Would it be possible to take a look at your code?
Now, to restart it, it should be possible to write a script that detects if the sketch is still active and if not then execute it again. Maybe monitoring through a log file if there's still activity within a given time, if not, then restart the sketch.
Hi. This scketch must always be running, controls up to 4 irrigation valves. For some error is closed, and wanted to control it.
The code is quite long and complicated to upload here. Thanks for the recommendation.
I understand. In that case, give a try to the suggestions above, or if you have a better idea to monitor if the sketch is still running you can implement it with a script.