Important: Please read the Qt Code of Conduct -

how to check 30 mins of inactivity using arduino ?

  • 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?

  • Lifetime Qt Champion


    What is an activity ? What defines the end of the activity ?

  • 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.

  • @SGaist I mean, when no button is pressed or released for 30 minutes, then all the lights that are turned on should be turned off. I dont know how to check whether no button is pressed or released for 30 mins?

  • @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.

  • @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.

  • Not sure if it works on Arduino but for standard operating systems there's:

Log in to reply