08-26-2019 04:39 PM
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
Solved! Go to Solution.
08-26-2019 05:29 PM
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
08-26-2019 09:10 PM
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).
08-26-2019 09:14 PM
Yeah, that was it. Change the 256 constant on that second quotient and remainder to 255 and it'll work without a glitch.
08-26-2019 09:15 PM
The 256 is the argument to a modulo VI, which only outputs 0-255. I'll look into your changes though! Thanks!
08-27-2019 06:52 AM
I don't have time to track it down further, but your second case structure is flipping your colors on the end points.
08-27-2019 09:06 AM
That's to achieve the reversal of direction in the color that I wanted.
08-27-2019 09:13 AM - edited 08-27-2019 09:13 AM
@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.
08-27-2019 10:13 AM - edited 08-27-2019 10:16 AM
@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! 😉
(... 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!)