Binary button must lock after using

  • Can anybody help how to get a Binary button in a sleep mode and cannot be used for 15 min. After 15min the button works again.

  • If your node is not battery powered, and you don't need to sleep the node, then you can just check the time with millis() and ignore button presses until the 15 minutes has passed.
    If you are running on battery and want to sleep the node to conserve power, I think this will be challenging, because millis() doesn't work for sleeping nodes.
    You could add a real time clock to your node. Then you could check the RTC for the time.
    If you want to sleep 15 minutes from the last button press, you could just sleep the node 15 min. Then you can check if the node woke from sleep due to button press or due to time and ignore the button press. But that is probably not what you are looking for. If someone pressed the button say, every 5 minutes, it would reset the clock each time and never wake up.
    You could also use one of the newer processors like the NRF5 series which can keep track of time while sleeping.

  • You could use an interrupt for the button. When the button is pressed the interrupt is disconnected and the node waits 15 min, then re-enables the button interrupt and goes to sleep - You don't say how often you are expecting the button to be pushed...?

  • Duh .. . yeah . ... like @skywatch said.

Log in to reply

Suggested Topics

  • 4
  • 14
  • 1
  • 2
  • 933
  • 5