siruami Posted October 26, 2009 Report Share Posted October 26, 2009 Hi all. I am completely new to LabView, I have version 8.5. I am trying to desing a VI that will measure reaction times given a visual stimulus, so I though in big LED that will turn on randomly, like every 2-4 seconds, but random and then the user will turn it off with one button. I have been playing with the random numbers, loops, LEDs, shift register, etc... and I have some pieces but can't get to what I want which is what I have stated above, so I will appreciate your help a lot. The Idea is so simple, once the VI starts, a LED will turn on randomly between 2 to 4 seconds between each blink, but when it turns on, I want the user to turn it off by pressing a button, once the button is pressed the random timer (2 to 4 seconds) starts again until the LED turns on again and the user turns it off and like that continuously for a number of times, I think I can resolve the total number of times this will run, add time stamps from the time blinks to the button is pressed and measure time, add a start button and everything else, I am just stuck with this of the LED turning on and off. Thanks in advance for your help. Again: version 8.5, thanks. Quote Link to comment
jcarmody Posted October 26, 2009 Report Share Posted October 26, 2009 This sounds like a job for a State Machine. It could be more easily accomplished with local variables and Sequence Structures, but I get hives when I use them. This'll give you your 2-4 second wait. A better State Machine would have a mechanism to wait that doesn't freeze the program until the delay finishes, but you can do that later. See if this helps and post back. wait.vi Quote Link to comment
hooovahh Posted October 26, 2009 Report Share Posted October 26, 2009 A better State Machine would have a mechanism to wait that doesn't freeze the program until the delay finishes, but you can do that later. I think this is an important feature, because right now if I press OK before the light turns on, then when the light does turn on, it immediately thinks I pressed the OK button and will register a reaction time of 0ms. A solution I think might be easier is replace the Time Delay, with a while loop that waits based on tick counts. Then in the while loop you can pole the OK button, and if it is pressed before the wait time is reached a dialog can pop up and say they were too early. Quote Link to comment
asbo Posted October 26, 2009 Report Share Posted October 26, 2009 My first thought was an Event Case with a random timeout (2-4s) with an event for the button which will catch pre-mature clicks. After that, a second event case with the current tick count wired into it with, again, a case for the button, with no timeout which will calculate the reaction time. Wrap the whole thing in a while loop or just use run continuously. Adding a reaction time history is trivial, either way. Quote Link to comment
siruami Posted October 26, 2009 Author Report Share Posted October 26, 2009 I agree with hooovahh because I actually need that feature, I will try to add it myself first after all this good thoughts you guys have shared with me and I do appreciate them. Thanks for the VI jcarmody, with my short experience in labview this is gold for me, I think I wont figure it out by myself in weeks, maybe months. I will review and modify to my needs and post back as soon as I can. Thanks a lot, I really appreciate you guys thoughts and help. Quote Link to comment
zythum Posted October 30, 2009 Report Share Posted October 30, 2009 I agree with hooovahh because I actually need that feature, I will try to add it myself first after all this good thoughts you guys have shared with me and I do appreciate them. Thanks for the VI jcarmody, with my short experience in labview this is gold for me, I think I wont figure it out by myself in weeks, maybe months. I will review and modify to my needs and post back as soon as I can. Thanks a lot, I really appreciate you guys thoughts and help. Just disable the "stop" button (not gray) and reactive-it when LED On Quote Link to comment
hooovahh Posted October 30, 2009 Report Share Posted October 30, 2009 Just disable the "stop" button (not gray) and reactive-it when LED On That's probably the best solution, I just wanted a way to penalize the user if they click too early. I suppose you could still do that with a mouse down event when grayed out. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.