06-11-2012 01:15 PM
Are you sure you shouldn't be using parallel loops? You stated the second case was dealing with a camera and just needed to start a particular time. If your camera code were in a second while loop you would use messages via a queue to tell it when to start and when to stop. Then the camera would run indepently of the other code.
06-11-2012 01:24 PM
Yes actually I have two while loops and these two cases are iside of it's. I think I need just "shift register" and with gates make this:
wire | button | OUTPUT
1 0 1
0 1 0
1 1 0
0 0 0
but for now I don't with which gate can I get that output.
06-11-2012 01:34 PM
Try createing a boolean array of your various conditions and then convert that to a number. Then your case would decide based on the number. So, in your example you would only set the output to 1 when the numberic value is equal to 2. That is assuming that button is in position 0 of the array and wire is in position 2.
I am still wondering if you should have both case structures in the same loop. If they are in different loops and you are wiring one to the other they will run in sequence since there is a data dependency between them.
06-11-2012 01:39 PM
I think yamada answered yur question but you may not have understood.
Wire ANDed with Button inverted.
YOu can use a compound artihmatic node and right-click it and choose "And" mode.
Right click the Button input to the gate and choose Invert to code up what you asked for.
Ben
06-11-2012 03:52 PM
Hi all, still don't get it 😕 I add picture which minimalize all my code (you can see 2 loops)
But if I wired like this on picture it's not working even "START" button anymore 😕 I need when "x" value become "2" will take one snapshot on camera (like this do "start" button)
06-11-2012 03:59 PM
Your second loop will not run until the first loop exits. I suggest you take a look at the producer/consumer examples for appropriate methods for communicating between two parallel loops.
06-12-2012 12:25 PM
Uff too much complicated for me 😕