Page 1 of 1

Longpress detection for mode change

Posted: Mon Feb 15, 2021 8:46 pm
by Hasina
I am trying to make a presettable voltmeter. It will show voltage normally. But when it will exceed the SET value an LED will glow. I did it using a TOGGLE switch as MODE CHANGER. I want to ENTER the SET mode by pressing the OK & UP button together for 5 secs.

Other buttons in this program are
One UP button, one DOWN button, and an OK button that writes the SET value into EEPROM.

Please how can I enter into SET mode Longpress and EXIT by pressing the OK button.

Thank you

Re: Longpress detection for mode change

Posted: Tue Feb 16, 2021 12:07 am
by medelec35
That does look like an assignment?
My suggestion is used a delay loop that looks a the button inputs then exits when buttons are released.
While in the loop have a count macro.
I don't want to give too much away as Teachers regally check these forums.