Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4829

C/C++ • Re: Timers in C++

$
0
0
Thanks @njh for your hint.
The only other "I/O" that will be in this control system will be push buttons (at least 4 of them).

The little code you posted is exactly the way I was thinking of doing it, or similar. I was thinking more at something like:

Code:

while true {if it's about time to service the fan {sleep until it's timetoggle the fan // if it was on, turn it off and vice versa}if it's about time to service the LED {sleep until it's timetoggle the LED}if button A has been pushed {do what needs to be done}check all the rest of the things that need to be checked, with a similar approach}
but now that I think further, that will probably keep my CPU awfully busy just checking for push buttons and timers that only seldom will need any attention.

Maybe the mechanism in the GUI toolkit you mentioned is a better approach. I was thinking of using wxWidgets for the UI. I will look in the documentation if they have something like what you describe, but in the meantime you, as an engineer, could tell me:

1) If wxWidgets is easy enough for a beginner or if you would recommend a different one, like Qt or gtkmm or something else, considering I have to learn whatever I choose from scratch, one or the other.

2) If wxWidgets is indeed the choice, do you know what the function that implements the mechanism you mentioned is called there, so that I can narrow down my search in the documentation?

Thank you.

Statistics: Posted by elrkoxo — Mon Dec 09, 2024 5:51 pm



Viewing all articles
Browse latest Browse all 4829

Trending Articles