LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

display different colors in one led

Solved!
Go to solution

thank you so much for your help. I try to use the case structure and it is work 

0 Kudos
Message 11 of 16
(313 Views)

Hi jiji,

 


@jiji_830 wrote:

I try to use the case structure and it is work 


It only "works" because you have set an integer limit.

Float values don't work very good with case structure selector inputs!

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 12 of 16
(309 Views)

@jiji_830 wrote:

jiji_830_0-1638317881457.png

 


No! Just NOOOOOO!!!!

 

  • Spinning the loop as fast as the computer allows (millions of times per second) just taxes your CPU, lowers the battery life of your laptop and/or increases your power bill. Your loop needs to have a wait.
  • Numeric case structure selectors are integers (Do you know the difference?). Using orange data causes coercions dots and potentially unwanted rounding. For example, see what result you get if the temperature is near the limit. Is that really what you want?
  • Placing the limits in the cases themselves is not scalable. Every time you need different limits or more limits, you would need to do massive editing of all cases. (In my example, all you need is change the array diagram constants, keeping the rest of the code untouched!)
  • Your LED is not connected to anything, so why is it in the loop?
  • LEDs are booleans and have two states. You are only using one but then you are swapping out colors of all states to simulate three states. Silly! Pure Rube Goldberg!
  • Writing property nodes is significantly more expensive because it is synchronous and requires a switch to the UI thread. For a colorbox (that can be made to exactly look like an LED if you want!) the color is the "value", not a "property". Changing a value is much more natural and much more efficient. Later in your career, you might want an array of color LEDs. Since properties are shared by all array elements, your property node method will no longer work. Array elements can all differ in value, so using a color box you can easily have arrays of color LEDs where each one is different.
  • Why do you have so many unneeded wire bends?
0 Kudos
Message 13 of 16
(296 Views)

Hi Christian,

 

I wonder what is the other case  behind "..35, default"… (anything <=35 and everything else?)

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 14 of 16
(291 Views)

@GerdW wrote:

I wonder what is the other case  behind "..35, default"… (anything <=35 and everything else?)


No way to tell from a picture, but I am expecting the worst case scenario. 😄

0 Kudos
Message 15 of 16
(289 Views)

thank you so much for you observation and your time. I will take this in consideration to correct my program

0 Kudos
Message 16 of 16
(288 Views)