Skip to content

Using RgbColor::Compare to detect end point for color blending fade. #814

Answered by Makuna
thatguy-jaysenodell asked this question in Q&A
Discussion options

You must be logged in to vote

https://github.com/Makuna/NeoPixelBus/wiki/RgbColor-object-API#static-int16_t-compareconst-rgbcolor-left-const-rgbcolor-right-uint8_t-epsilon--1
Epsilon is how sloppy you want the compare to be. You provided 200! Usually, 1, the default is good. Sometimes depending on how you are blending, you might go as high 6. But anything over 25 you may need to rethink your approach.

I think your iterative approach isn't a good one. Think time, how long do you want your blend action to take, from one color to another color. The LinearBlend can take either 0-255 or 0.0 -1.0 for progress. Iterate on this progress value from the original color to the new color, and not rely on comparing to end the loop.…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@thatguy-jaysenodell
Comment options

@Makuna
Comment options

@Makuna
Comment options

@thatguy-jaysenodell
Comment options

@thatguy-jaysenodell
Comment options

Answer selected by thatguy-jaysenodell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants