LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Removing graphical glitch from fluctuating LED

Solved!
Go to solution

Hi all,

 

I have an LED that I'm trying to have smoothly transition from green (#00FF00) to blue (#0000FF), and back. I have a working demo, but sometimes it experiences a graphical glitch where it blinks to different colors for an iteration. I've tried without success to reliably reproduce the glitch, but it seems to be ephemeral in nature. Any feedback would be tremendous.

 

Use a "milliseconds to wait" of 10-100ms to make the effect move quickly.

 

VI attached

0 Kudos
Message 1 of 9
(2,372 Views)

I can see a glitch on my system also.

 

When I change it to use a colorbox, note I get rid of the boolean and its property node, I rarely see glitch.

 

See this thread for a round colorbox.

 

See attached.

 

mcduff

Message 2 of 9
(2,346 Views)

I also see the glitch. I reimplemented the fading algorithm to check if it was the boolean control and its properties at fault, but don't see a glitch with this version (attached). So there might be a problem with the fading algorithm you've implemented. My gut feel is a value of 256 is being fed into the RGB VI, which only accepts U8 (0-255).




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
Message 3 of 9
(2,290 Views)
Solution
Accepted by topic author ijustlovemath

Yeah, that was it. Change the 256 constant on that second quotient and remainder to 255 and it'll work without a glitch.




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
Message 4 of 9
(2,284 Views)

The 256 is the argument to a modulo VI, which only outputs 0-255. I'll look into your changes though! Thanks!

0 Kudos
Message 5 of 9
(2,282 Views)

I don't have time to track it down further, but your second case structure is flipping your colors on the end points.

0 Kudos
Message 6 of 9
(2,234 Views)

That's to achieve the reversal of direction in the color that I wanted.

0 Kudos
Message 7 of 9
(2,216 Views)

@ijustlovemath wrote:

That's to achieve the reversal of direction in the color that I wanted.


It is not working as intended. It is flipping the values for one cycle. It reaches 255 Blue and 0 Green, the next cycle is 0 Blue, 255 Green, then the next cycle is 254 Blue, 1 Green. Try using a conditional break and highlight execution to see what it's doing.

0 Kudos
Message 8 of 9
(2,209 Views)

@ijustlovemath wrote:

That's to achieve the reversal of direction in the color that I wanted.


I would recommend to just pre-calculate the entire color array (ramp up&down) once before the loop and thn just index into it. Much less code and fewer places for bugs to hide! 😉

 

 

ramper.png

 

(... and of course I would use a colorbox. It can be made to look exactly like an LED but the code is much simpler and you don't need any expensive property node. The color is the value!)

 

ramper2.png

 

Message 9 of 9
(2,196 Views)