LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Let a LED burn on random time between 3 and 7 seconds

Solved!
Go to solution

Hello all,

 

Probably this is a simpel question for a lot of u, but not for me. I try to make a reaction time meter. And I hope someone can help me with the first part: the LED light needs to blink on a random time between 3 and 7 seconds. 

After that need to measure the time between burning led and pressing stop button

Results ordering in a array

after ten measurements display of average reaction time.

 

I hope someone can help me start this, I need it for school.

 

Thanks!

 

Matthijs

Netherlands

0 Kudos
Message 1 of 14
(4,048 Views)

Folks on this board are not going to do your homework for you.   If you ask more specific questions, you may get some help.  Take a look at LabVIEW help.  There is a random number function.  Also have a look at the "timing" pallete.

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 2 of 14
(4,042 Views)

Nobody needs to do my homework, but after 10 hours labview with no progress I think somebody can give me some advice to complete this execise myself...

0 Kudos
Message 3 of 14
(4,034 Views)

Did you go thorugh the LabVIEW Basic materials?. Try to post the code that you have tried before then you will get improvements for that.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 14
(4,030 Views)

I just don't know how to start. I have the labVIEW custom basic course manual. But my English is not that good so it's complicated, but nevermind I'll read it again.

0 Kudos
Message 5 of 14
(4,021 Views)

Read it and also you search into the LabVIEW help it has good stuffs in Fundamentals maybe you may get an idea to start when you look at them.

 

Good Luck

-----

The best solution is the one you find it by yourself
0 Kudos
Message 6 of 14
(4,018 Views)

There is insufficient and vague information in your problem description. First clarify exactly what you need to do.

 

  • How does the experiment start?
  • How does the user know when to start looking for an LED flash?
  • How does the user know when the experiment is over?
  • What should happen in the user does not react?
  • Should the LED flash briefly for a constant short duration and the 3-7 seconds is the off time?
  • Or should the LED go on until the button is pressed, which will measure the ON time, turn if off and arm for the next experiment?
  • I don't know what "results ordering in array" means. Do you want to sort the 10 results (descending,ascending) or create a histogram of the reaction time?

 

To start this project, design a state machine and define the various states:

 

  • idle
  • start experiment, (reset count to 0, etc.)
  • random delay
  • turn LED ON
  • Wait for response
  • Measure response time (place in array, increment count, check if 10 experiments have occurred, etc.)
  • caclulate average, display it, and go back to idle.
  • etc.

 

Define how the states connect as a function of parameters (e.g. after 1-9 results, go back to random delay, but after 10 experiments, go to results display, etc.)

Use shift registers to hold data (count, results array, etc.)

 

Do a search for state machine in the forum. Look at the design templates that ship with LabVIEW. (file...new...)

Message 7 of 14
(4,013 Views)
  • Experiment starts-> pressing start button
  • A time counter counts from 1 to 7 seconds
  • Between 3 and 7 seconds (random) a LED needs to light up
  • When you see the light you press a stop button
  • The time between start of the lamp and pressing the stop button is measured
  • This results needs to be ordered in an array
  • After 10 measurements the average reaction time is displayed and the program stops

This is it. I just can't (yet) translate it to a labVIEW program. 

0 Kudos
Message 8 of 14
(4,003 Views)

Spookdog,

 

Here's some code for you to study.  I've kept things simple but there are a few concepts you should read up about.

 

  • State machines
  • Shift registers
  • Event structures
  • Arrays
  • Local variables (a feature that is easily abused but OK when used appropriately)

The code is in LabVIEW version 2011.

 

Good luck.

 

~Simon

0 Kudos
Message 9 of 14
(3,992 Views)
Solution
Accepted by topic author Matt V

Simon's code de-bugged.  The Key Down was a nice touch but cannot be disabled so we were testing preaction times and the "Trial" param could get pretty messy especially on a repeat series


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 14
(3,987 Views)