FadeLed icon indicating copy to clipboard operation
FadeLed copied to clipboard

Inverting the output

Open dougp2 opened this issue 4 years ago • 4 comments

Thanks for the Library!

Would it be difficult to add an inversion feature/capability to the library? What I mean is, fading on/off seems to assume an Arduino output being driven high to light a common cathode LED. If the LED is common anode fade on/off must be reversed to show the desired effect.

dougp2 avatar Dec 22 '20 18:12 dougp2

Thanks!

Don't think it's worth adding it as a dedicated feature but it's already possible now. Just mirror the desired gamma table and use that table. This way the output is mirrored as well 😃

septillion-git avatar Dec 22 '20 19:12 septillion-git

Yes, reversing the table order inverts the fade effect. Thanks! This still leaves sines.on() and sines.off() acting backwards. Is a workaround possible with #define? Or, something else I could do without modifying the library?

dougp2 avatar Dec 22 '20 23:12 dougp2

.on() and .off() are just shorthand for .set(0) and .set(max) so they should also flip when you use a mirrored gamma table.

septillion-git avatar Dec 23 '20 16:12 septillion-git

.on() and .off() are just shorthand for .set(0) and .set(max) so they should also flip when you use a mirrored gamma table. ==========+=======

Yes, it is as you say. Thanks again!

dougp2 avatar Dec 25 '20 01:12 dougp2