3.2.1 - ResponsE time

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:

Slide3

Detailed instructions:

  1. Create a new, empty VI
  2. Insert a round LED
    1. Remove the label: Right-click -> Visible Items -> Deselect "Label"
    2. Enlarge it
  3. Make a numeric indicater and rename it "Response time (ms)"
  4. Create a flat sequence structure on the Block Diagram
  5. Insert cells into the sequence structure, so it has 4 cells in total
    1. Right-click the edge and choose "Add Frame After"
  6. Skærmbillede 2012-04-12 kl. 14.24.33In 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)
  7. 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:
    1. Skærmbillede 2012-04-12 kl. 14.22.18Right-click the input and choose Create -> Constant
    2. This creates a False constant - click on it to change it to True
    3. Save the time using a "Tick Count (ms)" - do not wire it yet
  8. 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)
    1. Enlarge the button on the Front Panel and place it just below the LED
  9. In the last cell, the LED has to be turned off, and the time saved (this is after the user has pushed the button):
    1. Skærmbillede 2012-04-12 kl. 14.23.28Create 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 neededSkærmbillede 2012-04-12 kl. 14.22.18
    2. Save the time again using a new "Tick Count (ms)"
  10. Now you need to subtract the saved time steps:
    1. 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.
    2. Connect the output to the Response Time indicator
  11. Run your VI, and see how fast you can hit the button after the LED is turned on
  12. Save your VI as ResponseTime.vi
Created by Samuel Thrysøe © 2013