On the go timer interrupts?
-
Hi.
I don't have so much experience in C++ so I don't know if it will be possible.
What I want is, at the moment I receive the order from the controller to switch on a light, if the light has a preset time running, create a timer interrupt at the end of the said period to turn that light off.
I would like those interrupt to be independant and generated, so if I have two lights, would behave the same.Do you think that is possible?
Thx!
-
@Sergio-Rius It is possible even without interrupts. But I think this kind of logic should be put in the controller. It saves you the coding and leaves the solution flexible.
So you create an on/off sensor. And just add a timer in the controller. Domoticz supports this without using scripting.
-
@TheoL Hi.
I think that a higher level of abstraction from the controller, and giving the node more personality suits better for me. Also I like reducing the unnecessary radio traffic.Let me explain something more my node. The node I'm working on it's basically a multiple actuator that abstracts from the code things like the number of relays or their behaviour.
At the moment, you are forced to populate a collection for it to discover and work with a variable number of elements, but as soon as I can I'll find a way to inject that info and avoid altering the code. Perhaps something like espeasy does, rflink activates it's rf modules, or even through a variable from the controller (worst of cases)Now it does all those things but the timer shutdown. I'm a good C# programmer, but I admit that it'll be difficult for me to adapt to C++. I still do all the things as I was doing in C#
I don't know anything about the scope or the behaviour of instantiated objects. I would like to tie a timer object to one element's property in the collection and let it run, but I don't know how, or if it will stay "alive" after the procedure ends
Suggested Topics
-
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
PJON and Minicore not working
Development • 10 days ago • Trand 10 days ago -
Adding Listen only device to my system.
Development • 26 Feb 2025, 00:39 • dpcons 26 Feb 2025, 06:26 -
Sending offset to node
Development • 31 Jan 2025, 00:59 • bsl88k 4 Feb 2025, 12:14 -
Saving last known good state, but not in EEPROM
Development • 30 Jan 2024, 18:46 • OldSurferDude 15 Jan 2025, 08:51 -
MQTT-Help me understand about the MQTT Gateway.
Development • 30 days ago • dpcons 19 days ago