LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ayuda

Tengo que sumar el numero de veces que se cumple una condicion booleana??

 

Ejemplo;

 

cuantas veces prende un led.. sumar las veces que su condicion fue TRUE

 

gracias

0 Kudos
Message 1 of 8
(2,835 Views)

translated by google:

 


I have to add the number of times a Boolean condition is met?
 
example;
 
LED lights a few times .. add the times your condition was TRUE
 
thanks


 

 

Is this a real LED or a control or indicator on the front panel? What makes the LED blink? How do you detect if the LED is on (light sensor, digital input, polling, etc.). What is the maximum rate at which it can change?

 

Can you show us a simplified version of your program?

 

You probably want to count how many times it went from OFF to ON.

0 Kudos
Message 2 of 8
(2,797 Views)

Hola Eduardo2416,

 

Gracias por utilizar los foros de National Instruments! Tal como Altenbach menciona, necesitamos mas información sobre lo que deseas realizar. Esta señal booleana viene de un LED fisico o es una señal de control de software (bandera)? Te hice un ejemplo muy sencillo de como podrías comenzar pero todo va depender de lo que desees realizar.

 

Example.png

 

Espero que esta información te sea de utilidad!

Luis CT
0 Kudos
Message 3 of 8
(2,764 Views)

LuisC_AE wrote:

 

Example.png

 


What is the purpose of the "equal true" function?

0 Kudos
Message 4 of 8
(2,759 Views)

Hi Luis,

 

you made the classic Rube-Goldberg: IF "Boolean equal to true" THEN true ELSE false… 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 8
(2,757 Views)

Hi guys!

 

Oh yeah! My mistake lol. It was very very quick example that I didnt even notice that "double" verification. Eduardo you can get rid of that verification, here's a better code:

 

Example.png

 

Regards!

Luis CT
0 Kudos
Message 6 of 8
(2,752 Views)

SInce we don't really know how the LED status is read by the code, "latch action" might be unrealistic.

 

Here's a code alternative that works for any type of mechanical action. (currently set to switch until released, like a car horn ;))

 

 

 

NOTE: The code would be even simpler with this idea implemented. 😄

Download All
0 Kudos
Message 7 of 8
(2,744 Views)

Thanks Altenbach! That is definitely a better way to go.

 

Eduardo, hope you find these examples useful for your application or project.

 

Best Regards!

Luis CT
0 Kudos
Message 8 of 8
(2,736 Views)