Jump to content

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 post
Share on other sites

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 post
Share on other sites

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 post
Share on other sites

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.

  • Similar Content

    • By Aishwarya Saravanan
      My project involves designing a front end for a synchronous generator using LabVIEW.   It is actually data acquisition and display of signals in a file.   The problem I face when building a program is that:   1)the sampling rate is set to 100 samples with 1 kHz sampling frequency.These signals are generated by daq assistant and i have used merge signals to merge these signals from daq assistant as well  as signals from other radio buttons and Boolean as well. The problem is that when written on a file I am able to see only one instance of Boolean status for every 100 samples daq assistant creates.   2) now iam able to write only 0/1 as status of Boolean in the file.How will I write on /off into file?

    • By pkeny
      Hey all,
      I am trying to create a fairly large program.
      What I want to do is for someone to upload a text file, customized so I can create statements for it, and then labVIEW will read the the text file and perform actions.
      Specifically, the text will contain pin numbers, on/off status, wait delay, and another on/off status. The pin numbers correspond to a Boolean indicator array. The on/off status tell the Boolean indicator array to turn on/off. The wait delay tells the program to wait how long before changing the indicator array value again, and the second on/off status turns the Boolean array on/off after the wait delay.
      I cannot get the part where I want the Boolean array to change status after the wait delay. I am thinking the method of doing this would be a local variable, or a property value node. But, when I tried it, it would not even let the original status to turn on/off the indicator Boolean array, let alone changing the status after the wait delay.
      I have attached my code and text file (tab delimited) for another method of explanation.
      Altenbach wrote a big portion of the code for educational purposes
      If you delete the local variable, you will notice that the boolean array changes based on the first text column, versus it being constantly Gray if you have the local variable. 
      Text Boolean.vi
    • By twols
      Hello guys!
      Is it possible to parse and evaluate a boolean expression stored in a string with standard LV VIs? I can't find anything..
      Expression like this one: 1==2 && (2!=5 || 2 > 5)
      I'm building a configuration xml-file with if-attributes for conditions:
      <item name="xyz" if="{namespace:variable} == 3" /> The first step is replacing the variables within {} with actual values. This is the easy part. The hard part is to evaluate the results...
  • Create New...

Important Information

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