12-24-2010 04:33 PM
Update: This discussion applies to Issues from the 2010 FTC season and is no longer relevant for current FTC competition software. Case selectors have been revamped under the hood in LabVIEW for LEGO MINDSTORMS. If you experience problems with case structures please create a new post.
I have a case structure with a front panel push button wired to the Selector.
This is all inside a while loop.
It seems the Case Selector is only evaluated on the first iteration of the while loop.
i.e. however the push button is set at the beginning of the program determines which Case is executed, and pressing/unpressing the button has no effect on the Case Selector.
I am confident the button state really does change, because I added something inside the True case which indicates the selector is actually false.
If I run this in "main application instance" it works fine. Toggle button switches between True and False cases.
Targeted to NXT, the same Case runs regardless of changes to the button state.
In the attached program, "correct" behavior is a rising tone when push button is True and a declining tone when it is false.
When targeted to NXT, if the button is true at the beginning, I get a rising tone, and toggling button False changes to a steady tone.
If the button is false at the beginning, I get a declining tone, and it keeps declining even after toggling True.
The "steady" tone is a result of running the "True" case with a "false" selector. i.e. in that case, the frequency of the tone is not incremented.
I've had other Case structures work OK in the past, so I'm at a loss for what I'm doing wrong in this case. (pun only slightly intended).
Thoughts? Suggestions?
Thanks,
David
p.s. this is my first time of running in "main application instance" and it really looks promising. Wire value Probe works and compile and run stage is MUCH faster. I feel the need for a better understanding of what it really means to be in one target or the other, but since the troubles described above are with the NXT target, understanding the target selection stuff better probably won't help with this question.
Message was edited by: David Fort
btw, using a "real" button on the NXT rather than a Front Panel Button causes the Case Selector to work as expected. Again, I'd be happy to conclude that front panel buttons are somehow fishy and not updating except that other logic that uses the value from the button is responding just fine.
02-01-2011 04:41 PM
Hi David,
I realize that you posted this a long time ago, but I wanted to see if it was resolved. When I run the code, the front panel control updates correctly. Did you debug your code using Highlight Execution to see if the value is actually changing?
Tanya V
02-01-2011 09:08 PM
No, I have not resolved this question.
I don't remember if I have tried "hightlight execution". I'll take a look
at it again after FIRST Robotics Ship Day (Feb 22) when I will suddenly have
endless hours of idle time at my disposal.
Until then, I'm focused on cRIO issues.
Thanks,
David