LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with 7-segment/display prompt

Solved!
Go to solution

Hi, I'm doing a whack-a-mole implementation and there are a few parts that I'm having problems with..

 

1. How to I make the 7-segment stop at 0 after the game runs for 60secs?

2. How to make the game over button light up after the game ends??

3. Replace the radio buttons and choose the levels from the user prompt instead??

 

Any help would be appreciated.. thanks..

0 Kudos
Message 1 of 9
(4,955 Views)
Solution
Accepted by topic author Flibbertygibbet

You need to take a few steps back and think about your code. You are doing things way too complicated. For example, the stop loop and the two timer loops can be combined onto one. The loops run at a fixed pace, no need to measure time, just count iterations!

 

Why do you need so many stop buttons??? Why are you using such a confusing cluster ordering? Make the displayed number the same as the array index for simplicity!

This is just the toip of the iceberg, there are many more problems. Get rid of the big stacked sequence. You can define execution order with the error cluster. 

 

  1. Start decrementing the counter at a fixed rate, starting at 60 and stop at 0. (see attached).
  2. Sust light it up whe the stop condition in (1) is reached. No extra code needed.
  3. Make a custom popup dialog VI tho enter all you want.

 

Message 2 of 9
(4,934 Views)
It seems the whack-a-mole has resurfaced.
0 Kudos
Message 3 of 9
(4,914 Views)
estionoh and 1 more question.. how do I make the LEDs light up at random? thanks.
0 Kudos
Message 4 of 9
(4,894 Views)

Flibbertygibbet wrote:
estionoh and 1 more question.. how do I make the LEDs light up at random? thanks.

 

Your question is ambiguous:

  1. Do you want to light them up in random order?
  2. Do you want to light them up at random time intervals?
  3. Both?

 

In any case, the "dice" in the numeric palette gives you a random number between 0 and 1. You can use the output to generate either random indices or random time delays.

0 Kudos
Message 5 of 9
(4,884 Views)
Sorry for not making myself clear. I want them to flash in random order.. I've tried replacing the numeric constant 3 on the array with a random number generator multiplied by 3 but it still flashes in sequence.
0 Kudos
Message 6 of 9
(4,879 Views)

The numeric constant is outside the loop, so that would not work, of course.

 

Simply generate a random number inside the loop at each iteration and do the Q&R to get the two random indices.

 

If this does not make sense, show us your code again.

0 Kudos
Message 7 of 9
(4,871 Views)
I've tried wiring the random number generation to the R and IQ but only 4 LEDs seem to light up. I've attached my code.
0 Kudos
Message 8 of 9
(4,858 Views)

You need to think this through! Once you generate random indices, you no longer need to increment anything. Why are you dividing by the random number??? You need to divide the random number by three! Some simple probing could have told you that this will not work right!

 

Here's a quick draft how you could do it.

 

Also some of your code is absolutely ridiculous. To create a string of consecutive spaces, you don't need to append N space constants. Simply use a string constant with N spaces. Right? Even better, do everything with a simple formatting operation in one step.

 

Also the way you built an array with two elements boggles the mind. Dont built a 1-element array and then insert the second element using "insert into array". Simply use built array with two inputs (see picture).

 

Message Edited by altenbach on 06-13-2009 02:34 AM
Download All
0 Kudos
Message 9 of 9
(4,850 Views)