Create a VI to measure response times from when an LED turns on, until the user reacts. You will need a flat sequence structure, and may use the flowchart below as inspiration. There are additional instructions below, but try to solve the task using just the flowchart first.
Flowchart:
Detailed instructions:
- Create a new, empty VI
- Insert a round LED
- Remove the label: Right-click -> Visible Items -> Deselect "Label"
- Enlarge it
- Make a numeric indicater and rename it "Response time (ms)"
- Create a flat sequence structure on the Block Diagram
- Insert cells into the sequence structure, so it has 4 cells in total
- Right-click the edge and choose "Add Frame After"
- In the first cell, the VI will hold for a random number of seconds from 0 to 10. Implement this using a "Wait" function (remember to use ms)
- In the second cell (after the wait time has elapsed) the LED must be turned on and the time saved. Move the Boolean icon into cell 2 and set the input to true:
- Right-click the input and choose Create -> Constant
- This creates a False constant - click on it to change it to True
- Save the time using a "Tick Count (ms)" - do not wire it yet
- In cell 3 the VI has to wait for the user to hit the response button. You can implement this by inserting an empty While loop inside, with a STOP button wired to the Loop Condition(the red circle inside the While loop)
- Enlarge the button on the Front Panel and place it just below the LED
- In the last cell, the LED has to be turned off, and the time saved (this is after the user has pushed the button):
- Create a local variable for the LED by right-clicking it's icon and choose Create -> Local Variable. Place this in the last cell. Right-click the input, and choose Create -> Constant - by default, this creates a False constant, which is what's needed
- Save the time again using a new "Tick Count (ms)"
- Now you need to subtract the saved time steps:
- Add a "Subtraction" function outside the sequence structure. Wire the last Tick Count with the top input, and the first Tick Count with the bottom input.
- Connect the output to the Response Time indicator
- Run your VI, and see how fast you can hit the button after the LED is turned on
- Save your VI as ResponseTime.vi