LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting Total number of LED turn on

Solved!
Go to solution

Hi, 

I doing LabView project with count total number of LED on and match with random number to turn on another LED. How to count LED turn on / off?

0 Kudos
Message 1 of 6
(3,311 Views)

"Boolean to 0,1", then add the numbers. (Or if the LEDs are in a 2D array, use "add array elements" to get the sum).

 

(It is typically more helpful to attach the vi)

0 Kudos
Message 2 of 6
(3,303 Views)

Hi altenbach,

I have try another method but still not working. How to use "add array elements" to get the sum?

0 Kudos
Message 3 of 6
(3,288 Views)

@KnightBS wrote:

I doing LabView project with count total number of LED on and match with random number to turn on another LED. How to count LED turn on / off?


First you need to define the problem. Where is the random number coming from, what is the definition of a "match", and where is "another" LED? Should that depend on the random number? What if the LED is already on?

 

LEDs are typically indicators, you seem to be using them as controls. But you also want to turn them on based on the random number. Who should win?

 

Looking at your latest VI tells us that you have little to no experience with LabVIEW because almost 100% of the code makes no sense and gives no additional clues what you actually want. Why all these duplicate event cases? One is probably enough. Why all these coercion dots and disconnected indicators?

 

  1. What does the user see after starting the program?
  2. How does he interact with it?
  3. Where does the random number come from?
  4. What should happen in all possible combinations of operations?

This almost looks like a school project. Maybe it would be easier if you would quote the problem description verbatim as the teacher wrote it..

0 Kudos
Message 4 of 6
(3,264 Views)
Solution
Accepted by topic author KnightBS

In any case, here is one possible way to count the number of LEDs that are ON.

 

No need to hide each control in a different event structure, just create a single event for all LED value changes. Or just poll them at regular intervals. No event structure needed.

 

LEDSum.png

 

Message 5 of 6
(3,261 Views)

Hi altenbach,

I am beginner in LabView. This is my own research project. The main functions of this project are,

1. Count how many LEDs on and show in LED sum.

2. Random number is generate random number within 0-6.

3. Square LED will going on if random number is same match with LED sum.

 

Thank you for reply my question.

 

0 Kudos
Message 6 of 6
(3,253 Views)