I'm busy with my camera trigger tool. I use two buttons and a LCD display. At the begin i have to set the time for the trigger. I made a nice menu for that, but here's my problem.
I want to use the same button for set the time one by one (so 1,2,3,4 eacht time i press the button). But when i hold the button for let's say 2 seconds i want that i goes up without pressing the button each time.
You need to make a 'state transition diagram' - basically draw a circle for each 'state' and arrows between for the transistions (here these will be button-down, button-up and certain amounts of time passing). Actions taken you label on the arrows.
This then 'translates' to code in a fairly straightforward manner (if in state A and event B happens, do action C and move to state D...)
Give the states meaningful names like 'not pressed', 'button just pressed', 'button held down'... Make sense?
I suggest my phi_buttons class library to handle buttons. It has repeat function built in so if you hold the button then the button fires automatically. It also has a dash function built in so if you hold the button for a long time, it fires more rapidly. There are also auto buttons that are pressed automatically at fixed interval if you should need that.
My phi_prompt library should be able to handle any menus and inputs.