Hello,
I started to work with arduinos for my electronic projects. Currently I try to build a word-clock. To avoid unclean programming I found the library IoAbstraction. I like to work with events (my job is to work with C#) so I tried to find a solution for that. For timing issues or hardware switches it is perfect. I still use it for that.
But now my question:
It is possible to use this library for triggering an event by software.
For example I have a class called DCF. This class is responsible to receive the time by DCF77. If a new time is available it should fire an event. So it is not really a hardware event. It should be triggered by software.
class DCF {
private:
ExecuteNewTimeReceived();
...
...
public:
DCF();
...
...
}
in my main program I would like to register the class "DCF". If the ExecuteNewTimeReceived() function will be run in class DCF an event should be fired and the main program can do something.
Currently for this issue I use a timing event and ask the DCF if a new time is available. It works for sure but maybe there is a better way to do that.
taskManager.scheduleFixedRate(100, checkNewDataDCF);
void checkNewDataDCF() {
// check if new data of DCF is available
if(dcf.CheckForNewTime())
{
....
}
}
My next step would be to extend the library by myself to have this feature. I think it is similar to the SwitchInput Class...only that I is not triggered by hardware.
Thanks in advance for your help! And thanks for the great library!!