LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LED sequence

Highlighted

Hi,

 

I am trying to create a sequence where the LED lights up sequentially for 200ms each. If the switch corresponding to the lighted LED is flipped within then 200ms, the LED turns off and the next LED turns on. However I can't seem to be getting what I want. Can somebody pls help me with this or tell me what errors I'm making? I've attached my file. Thanks

0 Kudos
Message 1 of 8
(2,406 Views)
Highlighted

I hate to be the one to tell you this, and forgive me for being blunt, but your code is an absolute mess. This seems to be a whack-a-mole game implementation. What is the purpose of all those Boolean switches? Are those intended to be use to "whack the mole"? In what sequence are the LEDs supposed to light up? In a specific order? Randomly?

 

I would suggest reading up a bit on programming architectures, like the state machine. If this is supposed to be a "whack-a-mole" game then I would suggest using an event structure and handling the user clicking on the LED (by handling the MouseDown event on the LED), rather than having the user flip a switch. 

 

You may also want to take a look at the XOR truth tableSmiley Wink

Message 2 of 8
(2,395 Views)
Highlighted

I agree that you probably should start out with some simple tutorials.

 

Here's a very simple draft to get you started. See if you understand it. 😉


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 3 of 8
(2,381 Views)
Highlighted
Thanks for the advices. This was suppsoed to be a whack-a-mole implementation. Still finding my way around LABView. That was my first try and the flip switches were meant to be used to hit the moles. Altenbach's draft helped a lot. Thanks again!
0 Kudos
Message 4 of 8
(2,340 Views)
Highlighted
Hi.. i have another question.. how do I make the LED light up at random?
0 Kudos
Message 5 of 8
(2,297 Views)
Highlighted

If you have e.g. four LEDs, you could generate a random number at regsular intervals and, depeding on the value, light LED1 if the number is 0..0.1, LED2 (0.1..0.2), etc. and have them all off if the random number is 0.4..1.

 

Simply generate a random number using the "dice" from the numeric palette.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 6 of 8
(2,292 Views)
Highlighted
Hi.. I've modified the code and decided to do a 3X3 LED array instead based on the file altenbach sent.. However I cant seem to connect certain arrays. Can someone please help me with it? thanks
0 Kudos
Message 7 of 8
(2,257 Views)
Highlighted

Well, now you are dealing with 2D arrays, so you should run the index up to the product of the two dimensions. Use Q&R to recover the two indices.

 

Here's a quick example. Makes sense?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 8 of 8
(2,244 Views)