Start a new topic

IF button is pressed for more than 1sec

hi everyone I am trying to make an action if a button is pressed for more than one second. Any idea how to do this with nextion and arduino? Thank you so much Filipe

 in general,

- on press enter button just start a timer (intervall 100ms) ... and initialize a counter with 0

- on press release just stop the timer

- inside the timer, check the counter, and if the counter is >9 you know the button is pressed longer than 1 sec.

Hope this helps


Hi Gerry Thanks for the fast reply. Can we set a timer on the display when the button is pressed or are you talking about doing this on the srduino code? Thanks again for help.

Hi Filipe,

that's all done in your HMI just have a look to attached example ...

When you press the button, it triggers >1s, >2s and release


Login or Signup to post a comment