Jump to content

Boolean Loop Choice Test

Recommended Posts


I am having trouble coding a VI. I am wishing to make boolean based vi in which the user has to select a choice which color is brighter or dimmer? I want to randomize the choices so that it isn't always making a higher choice or alternate the presentation. I want to record the time of presses with the millisecond counter vi. I also want to record the number of correct and incorrect choices so that if they get 3 correct the colors seem closer in brightness and shift the color choices close to matching after 3 correct guesses until they get 3 incorrect guesses. Any insight on how to do this would help greatly.



Link to comment

I have attached the file. I want to store the number of times the boolean is pressed. Also I want to make other conditions so if the individual does not select the right choice it goes to a previous condition. For example, if the person selects the wrong choice in "psychometric 2" then it goes to the "psychometric " vi or condition.

Any coding help would be GREATLY appreciated.



Link to comment

The easiest way to count the button presses is to use the Event Structure, like this:


Every time the button gets pressed, the value in the shift register gets incremented by one. Look at some example files (use Help >> Find Examples... in the menus) of usages of the Event Structure.

You probably also want to combine this with a basic state machine pattern. You essentially have 3 states: "Draw the two colors", "wait for button to be pressed", "Evaluate results". You can code that up like this:


In the "Wait For Buttons" case, put the Event Structure.

In each case, you decide which frame you want to happen next. Sometimes it will be a fixed constant, sometimes there will be some decision about which frame to go to next.

This is the state machine pattern and there are lots of good examples of it, also, in the Example Finder.

Good luck.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.