how to check 30 mins of inactivity using arduino ?
-
wrote on 30 Jun 2017, 19:36 last edited by
Hi,
I am using QT with arduino to control all the gpio pins on the arduino. I have connected gpio pins to the buttons to turn them on or off. Now I want to monitor the time of inactivity (the time during which no QPushButton was pressed/released) . That is if nothing happened for 30 mins, all the pins will turn off.
I have made a QPushButton to turn off all the lights whenever a user wants to.
Can anyone suggest a way on how to monitor the inactivity period? -
Hi,
What is an activity ? What defines the end of the activity ?
-
wrote on 1 Jul 2017, 14:45 last edited by
I would add a routine to the pushbuttons' pressed signal that saves a timestamp of the last press and starts a QTimer for 30 min. The slot which QTimer calls would check the timestamp and turn the lights off it 30 min has really passed. If not, call QTimer again.
-
I would add a routine to the pushbuttons' pressed signal that saves a timestamp of the last press and starts a QTimer for 30 min. The slot which QTimer calls would check the timestamp and turn the lights off it 30 min has really passed. If not, call QTimer again.
-
@mvuori that is just for 1 button. I have more than 60 buttons to monitor. If the user doesn't press/release any of the 60 buttons, then all the buttons should be turned off.
wrote on 1 Jul 2017, 19:52 last edited by@jkprog And? When you generate the buttons, just add the same signal-slot connection to each. As per your description, you just need to know when the last button press was made. Make one slot that doesn't care where the pressed signal comes from. I see no problem here.
-
wrote on 3 Jul 2017, 07:37 last edited by
Not sure if it works on Arduino but for standard operating systems there's: https://api.kde.org/frameworks/kidletime/html/index.html
1/7