Button... Controll Menu Question

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Button... Controll Menu Question

Post by Jordy101091 »

Hi all,

Im working on my rewrite of my aquarium controller, Im currently working on the menu and want to use one button for entering and exiting from the menu.
I want to do this by using a short press to go to the next item of the menu and a longer press (2sec) to exit the menu.

I dont know how to go around this, maybe you can help.

Regards Jordy
the will to learn, should not be stopped by any price

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Button... Controll Menu Question

Post by medelec35 »

Hi Jordy,

There are a few ways of doing this.
Attached is what I believe is the simplest way using one button.
There may be other ways of course.

I could create a flowchart using several buttons, but will be more complex

Flowchart will also eliminate issues caused by contact bounce.

Martin
Attachments
Button Control1.fcf
(15 KiB) Downloaded 426 times
Martin

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Button... Controll Menu Question

Post by medelec35 »

I have added 2 more switches.
So now you can short press or long press any combination simultaneously.
I have mapped switches with keys 0 to 2.
so
Key 0 will control switch connected to A0
Key 1 will control switch connected to A1
and Key 2 will control switch connected to A2
You can also have a combination as stated earlier.
E.g press keys 0 and 1 and keep held for a second for long press A0 & A1
or press keys 1 and 2 and release key 2 for short press A1 and long press A2 etc.
So now you can have 24 menus from just 3 switches (if I have worked it out correctly, prob not :lol: )
Attachments
Button Control2.fcf
(24.39 KiB) Downloaded 397 times
Martin

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Button... Controll Menu Question

Post by medelec35 »

This version works much better on hardware with more than one switch pressed simultaneously.
Attachments
Button Control3.fcf
(24.59 KiB) Downloaded 437 times
Martin

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: Button... Controll Menu Question

Post by Jordy101091 »

Thanks Martin you are a genius.
It helped me a lot.
Thanks
the will to learn, should not be stopped by any price

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Button... Controll Menu Question

Post by medelec35 »

Thanks Jordy,
Glad the code has helped you.

Martin
Martin

Post Reply