Showing results for 
Search instead for 
Did you mean: 

Hi need explanation of this question

Go to solution

 Develop a “Mackworth Clock” in LabVIEW using 12 LEDs. Basically, this Clock is used a vigilance test to find out the alertness of a person while doing repetitive work which may result in fatigue.


With the understanding of how a “Mackworth Clock” works, develop using LabVIEW a clock using 12 LEDs.

  1. The LEDs will turn on individually one at a time in the clockwise manner at an interval of 1 second, just like a second hand of a clock.
  2. At random, it will skip one LED.
  3. When an LED is skipped, the user must press the spacebar within 200 msec. If the software did not detect the spacebar being pressed during the 200 msec, it will be recorded as 1 miss.
  4. However, when the user pressed the spacebar when there is NO skip of LEDs, the software will record as 1 false hit.
  5. At the end of the 5 mins test, the total of misses and false hits will be tallied and display on the front panel.

      6. A numeric display also shows the number of misses in percentage

0 Kudos
Message 1 of 15

I would suggest asking your professor or whoever assigned you this project. If you have specific LabVIEW questions feel free to post those here.

0 Kudos
Message 2 of 15

Not sure what you mean by "explanation of this question".


Do you have a problem understanding the requirements or do you have a problem translating them to LabVIEW?


Is there any specific item in the requirements that you don't understand? Which one?


What is the probability of "random"? What should the user do if two or more LEDs are skipped at once? 

Do you know LabVIEW? How far did you get? Did you place the LEDs? Did you find a mechanism to read the space bar? Should it also show a count-down clock for the 5 minutes?


Do you have a specific question?

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 3 of 15

is more like im unsure what to start at block diagram... Im lost..

0 Kudos
Message 4 of 15

Ask yourself "What happens".  For the time being, don't get hung up on "How does it happen".  Here are some "What Happens" things that I see:

  • The clock "ticks" once per second.
  • The clock can either "Tick" (move its Second Hand) or "Tock" (not move its Second Hand).
  • There is a Rule that determines whether the clock "Ticks" or "Tocks".  [What is that rule?]
  • The User can push a button at any time.
  • You can determine when the User pushed the button.
  • There is a Rule that determines whether the Button Press was a Hit, a Miss, or an Oops (think about how you would define these three with respect to Ticks and Tocks).

There may be other "What Happens" to think about. You should do all of this with pencil and paper.  Once you have a good notion of "What" you want to do, you can start thinking about "How" you could use LabVIEW to carry out some of the tasks.


We obviously don't know what you have been taught about LabVIEW.  We also don't know how much attention you have been paying in class (or how many times you've viewed the Tutorial Videos and actually have done the Exercises yourself, from scratch).  


I hope no-one simply "Posts" a "Solution" to this problem, as it will cheat you out of a chance to Learn LabVIEW.  Give it a try.  See if you can, at least, make the Clock Tick.  [Here's a "How" -- How would you implement the Clock, meaning how do you want to make it look?]


Bob (can you guess one of my "job titles"?) Schor

0 Kudos
Message 5 of 15

@gavinng wrote:

is more like im unsure what to start at block diagram... Im lost..

Do you have a diagram?


If you don't, start with some (free) courses.


If you do, post it and tell us where the problem is.

0 Kudos
Message 6 of 15

@gavinng wrote:

is more like im unsure what to start at block diagram... Im lost..

You definitely need a toplevel while loop so the code repeats forever or until stop is pressed.

Then you need some kind of timing. A 10ms loop time would seem reasonable. Go to the next (or skip one) LED whenever the iteration is divisible by hundred. (what kind of time resolution do you really need?)).

devise a mechanism to measure reaction time. Typically one would take the difference between tick counts (one taken at the LED skip, and one taken at the button press). Compare the elapsed time with 200ms to decide success vs failure.

You need a random number generator that sometimes skips an LED.

You need some way to accumulate results. Typically a shift register comes in handy to accumulate # of tries and # of successes.

To work out most of the logic, use a big button that the user needs to press (you can switch to reading the space bar later).


Start simple, then add features:

  1. First, create a program that turns on LEDs in a repeating sequence, nothing else. Tweak until it works the way you like it.
  2. Now add a random element that sometimes skips an LED. Decide on a reasonable probability (e.g. 5%). If the probability is too high, it will skip most of the time and if it is too low, you get poor statistics.
  3. Now add more features until the program does everything you want.
  4. Good luck!

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 7 of 15

Hi guys this my vi. Currently im stuck here.

0 Kudos
Message 8 of 15

Hi Gavin,


please do some training before starting to code.

No need for huge sequences and lots of local variables!


Just a suggestion to replace your current code:

No need for 12 single LEDs when you can use an array.

No need to repeat code: this usually is done using a loop!

(The code in this picture still is "bad" and highly user-unfriendly…)

Best regards,

using LV2020 on Win8.1+cRIO
0 Kudos
Message 9 of 15

Wow! How much time did you spend to create all that duplicate code?? If you can explain the problem in a few sentences you can assume that the diagram should not be larger than a postcard. 😉


Use a cluster of 12 booleans and operate on a boolean array to be converted for display. Here's a quick draft (took me minutes, mostly to arrange the LEDs in a circle :D) to show how to cycle the LEDs and skip occasionally.


Now try to incorporate the button and add some timing. As I said, spin the loop at a fast rate, reset a timer whenever the boolean is skipped, then see how much has elapsed when the button is pressed. (none of that is implemented in my example)


  • Spin loop at 10ms.
  • whenever 1s has elapsed, increment position
  • Skip with a certain probability and start timer when skipped
  • If elapsed is > 200ms, increment failure counter. This will also increment for false presses, e.g. if the LED was not skipped.
  • Increment another counter for each LED skip.
  • Use both to calculate success rate.
  • You need to make sure to count false presses, else the user might just constantly click without looking to get 100% success rate.




LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 10 of 15