help please

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
stevel
Posts: 19
Joined: Sat Sep 05, 2009 2:18 pm
Contact:

help please

Post by stevel »

can someone help me out my flowcode files not working as i want it to switches dont change pattern of leds can some one look at my file and alter it if needed
Attachments
leds.fcf
(7 KiB) Downloaded 271 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: help please

Post by kersing »

Due to the use of the "while 1" loop in the "Yes" parts of the decision statements the code will never reach the point where it would read the switches again once you have pressed either switch 1 or 2. There are several ways to solve this, one is to run the loop a limited number of times. Another option would be to read the switches in the loop and exit that loop if a switch is pressed.

The attached example implements these options. If you press switch 1 all leds should light for 2 seconds. If you press switch 2 only 4 of the leds will light at a time, changing every .5 second until you press (and hold for up to 1 second) any of the switches.

Hope this helps.
Attachments
leds1.fcf
leds1.fcf
(7 KiB) Downloaded 292 times
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Post Reply