3 switches 1 reset

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
siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

3 switches 1 reset

Post by siliconchip »

hi all i have 3 leds and a switch assigned to each led only 1 led can be lit at any time if another led is required to be on then using a reset button common to all 3 leds this extinguishes the led and the button for the required led can be pressed to light it, trouble is i cannot get led 3 to light also on hardware is does not work although in flowcode sim the first two leds work i have tried in a previous flowchart using decision icons in stead of the switch but any button would extinguish the led any help please
Attachments
switch.fcf
(17.77 KiB) Downloaded 181 times

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: 3 switches 1 reset

Post by medelec35 »

Hi siliconchip,
Can you give this a try please.

I have deleted the unused variables so u know what variable are involved.

Martin
Attachments
switch V2.fcf
(13.5 KiB) Downloaded 186 times
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: 3 switches 1 reset

Post by siliconchip »

hi martin thanks for the reply i have just used your version on hardware (mikroelektronika easy pic 5 board ) it is working some of the time but occasionally if a button is pressed 2 leds will light instead of 1

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: 3 switches 1 reset

Post by medelec35 »

Hi siliconchip,
Your welcome.

I have just set my hardware up so Switches connected to port A & LEDs connected to port B.
unfortunately I can't get more than one LED on at the same time :(
Can you tell me which switch you pressed to get more than one LED on please so I can see if I replicate the issue.
Could you have a hardware fault like two shorting LEDs?
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: 3 switches 1 reset

Post by siliconchip »

i got 2 leds on by pressing button A0 and same thing happened on A1 button not sure about the shorting on my board so tried a night rider led program as a test and this worked ok

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: 3 switches 1 reset

Post by medelec35 »

Odd. I can't get mine to play up. :?
Just in case I have missed something.I have altered Flowchart to make it impossible for more than 1 LED to be on.
Can you try this one please.
No debouncing is required since as soon as any of the on switches are detected, all switches except reset are locked out.

Martin
Attachments
switch V2.fcf
(15.21 KiB) Downloaded 210 times
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: 3 switches 1 reset

Post by siliconchip »

hi martin just tried the flowchart using hardware and it works great there is no interferance from other switches with leds etc and its working a treat once again a big thankyou i now understand the masking concept a little better :D

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: 3 switches 1 reset

Post by medelec35 »

Hi siliconchip,
Your welcome :)

Glad latest one is working better for you.
Thanks for letting us know.

Martin
Martin

Post Reply