LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Easy metronome question?

I'm trying to make a metronome application. This is my first real? labview app so it might look kind of funny. I think it works for the most part but I'm not entirely sure how accurate it is. Even if the timing is correct I seem to be losing accuracy somwhere. I tried to comment as much as possible.

 

Any ideas or suggestions? Thanks for everyones help. 

 

Seth

0 Kudos
Message 1 of 3
(3,801 Views)

I think you are going about your lower loop the wrong way.  First, the inner while loop will run infinitely fast eating up CPU cycles.  Second, the timing  of the lower loop will be affected by the time it takes the person to clap along with the other code in that loop.  There is no synchronization between the upper loop and lower loop.

 

I think you should use an event structure to detect when the person hits the clap button.  I would use perhaps either a notifier or rendezvous to help synchronize the code between the upper and lower loops.  Perhaps capture the millisecond timer up top when the ding is sent and capture the millisecond timer down bottom in the event structure when the person hits the clap button.  Pass one to the other (notifier, single element queue, ) and compare the values.

Message 2 of 3
(3,791 Views)
Thanks. that makes sense. I'll give it a try and post what I come up with.
0 Kudos
Message 3 of 3
(3,770 Views)