SWITCH WOES

For general Flowcode discussion that does not belong in the other sections.
Post Reply
siliconchip
Posts: 55
http://meble-kuchenne.info.pl
Joined: Wed Dec 16, 2020 10:38 am
Has thanked: 21 times
Been thanked: 1 time

SWITCH WOES

Post by siliconchip »

Hi all
im trying to switch between 4 branches on a switch icon, i want to be able to select at random then by storing the position either 1,2,3 or 4 then to use the stored number in this case the variable "store" to proceed to the corresponding data on the following four branches SWITCH ARRAY "SELECT" disabled so if branch 1 selected once chosen by switch "GO" its isolated until the rest of the program is executed so in other words if any other selection pressed the selected led stays on regardless if another switch is pressed any help would be greatly appreciated

cheers bob
Attachments
SWITCH.fcfx
(18.42 KiB) Downloaded 119 times

chipfryer27
Valued Contributor
Posts: 2090
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 465 times
Been thanked: 695 times

Re: SWITCH WOES

Post by chipfryer27 »

Hi

Not too sure I understand what you want. Perhaps some punctuation would help <s>

Your chart simply loops and depending on button pressed illuminates the corresponding LED, keeping it illuminated until another button is pressed. What should it do?

Regards

siliconchip
Posts: 55
Joined: Wed Dec 16, 2020 10:38 am
Has thanked: 21 times
Been thanked: 1 time

Re: SWITCH WOES

Post by siliconchip »

Hi the leds are just purely to show what channel you select once selected the single switch then allows to come out the loop to do the rest of the program thats fine but when it comes out of this loop if you pressed any buttons to do with the leds they still change id like them to stay on the channel picked instead of still being able to be changed

Cheers bob

chipfryer27
Valued Contributor
Posts: 2090
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 465 times
Been thanked: 695 times

Re: SWITCH WOES

Post by chipfryer27 »

Hi

So if I understand correctly:-

1) It loops until a button is pressed.
2) It illuminates an LED to illustrate which button / channel.
3) Keeps looping until "Go" is pressed.
4) Whilst waiting for "Go" to be pressed it should ignore all other button presses.
5) Once "Go" has been pressed it "does something".
6) It then presumably starts all over again?

Is the above along the right lines?

Regards

siliconchip
Posts: 55
Joined: Wed Dec 16, 2020 10:38 am
Has thanked: 21 times
Been thanked: 1 time

Re: SWITCH WOES

Post by siliconchip »

Hi
Its after go is pressed it should ignore all other button presses and stay on the chanel selected

Cheers bob

chipfryer27
Valued Contributor
Posts: 2090
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 465 times
Been thanked: 695 times

Re: SWITCH WOES

Post by chipfryer27 »

Hi

One way is to :-

In your switch calculations include setting a Flag (e.g. Flag = 1 or such like) if a button is pressed
Before your switch component have a decision, if Flag = 0, then put your Switch component in the Yes branch

The chart will loop until you press a button, then as you will set your Flag it will no longer branch to your switch component at all.

Later, perhaps at the end of your Go branches you could reset Flag to 0 re-enabling the switch

There are other ways but this should help.

Regards

Post Reply