Hopefully some of the Gurus on here will be able to point me in the right direction with the coding that I need to use to set the time on a clock using a single button. I am trying to achieve this using a single button and long and short presses;
Attached is a flow chart of what I am trying to achieve;
I have found the ezButton library online which from what I understand has the De-Bounce already included which should make the coding slightly easier.
Is there an easy way of coding this or will I require lots of if, else & if else functions?
The reason for the single button is because I am adapting an old piece of test equipment to house the clock as a retirement present for a colleague. The test equipment only has one switch on the unit.
Besides, your flowchart needs elaboration. Looks like if I press the button, minutes will just tick up constantly until I take my finger off. At what rate?
How can you act on the button held for 2 seconds and avoid incrementing the minute or your during that 2 seconds?
It all may be tots clear to you, but the flowchart is not ready for coding.
And you’ll go to that special place in hell reserved for people who make me press the button 47 times if I happen to set the clock at an inopportune time… or wait 47 intervals with my finger on the button watching my life tick by like the minutes I am trying to set on this stupid clock. Only to miss it and have to try again.
I had a clock that needed to be plugged in at 12:00, there was no setting button(s). I think I’d actually prefer that.
—> Just put some more buttons inside or on the back or wherever.
alto777:
And you’ll go to that special place in hell reserved for people who make me press the button 47 times if I happen to set the clock at an inopportune time… or wait 47 intervals with my finger on the button watching my life tick by like the minutes I am trying to set on this stupid clock. Only to miss it and have to try again.
I'll admit the flow chart is a little basic and was just to show the basic steps. The theory in my head is that after a 2 second hold of the switch, every further press (less than 2 seconds) will increment the minute / hour by one.
However I understand the frustration that can be caused by missing the minute you want and having to go around again.
I think for ease of programming (as I'll admit that I'm not the best at it) I think ill have to admit defeat and include a couple of extra switches.