Skip to content
\n

My assumption is that I'm using the RgbColor::Compare incorrectly (or missing somthing obvious). I could not see any use of RgbColor::Compare in the examples.

\n

Thank you in advance for any hints.

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

https://github.com/Makuna/NeoPixelBus/wiki/RgbColor-object-API#static-int16_t-compareconst-rgbcolor-left-const-rgbcolor-right-uint8_t-epsilon--1
\nEpsilon 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.

\n

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. Then change the time based on the steps you take for progress and the delay you use in the loop. This is the technique used in the animation examples, look at the animation callback. All the animation system really does is manage the time and this progress value as a float (0.0-1.0) for multiple \"animations\" so reduce code that you would need to implement.

","upvoteCount":1,"url":"https://github.com/Makuna/NeoPixelBus/discussions/814#discussioncomment-10076127"}}}

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