Im just wondering if its posible to be able to control a loop with a switch input using a single bit assignment. What I want to do is have a switch input that calls a loop to execute ONLY while the switch is depressed...once i release the switch id like the loop to stop. is this possible?
any help would be great
Loop control varibles
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
It certainly is possible to do that.
Firstly use an input block with the bit you want to test masked. Read this input into a byte variable eg. Bit_Test.
Then use a while block and set the conditions to while Bit_Test
Remember to place an second input block inside the loop to update the Bit_Test variable so that the loop will exit when you stop pressing the switch.
Firstly use an input block with the bit you want to test masked. Read this input into a byte variable eg. Bit_Test.
Then use a while block and set the conditions to while Bit_Test
Remember to place an second input block inside the loop to update the Bit_Test variable so that the loop will exit when you stop pressing the switch.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel