Fading Arduino RGB LED from one color to the other?

后端 未结 7 1867
攒了一身酷
攒了一身酷 2021-02-03 12:15

I\'ve currently managed to get my LED to cycle through eight colors that I\'ve selected. Everything is working correctly, except that I want to go for a more natural feel, and w

相关标签:
7条回答
  • 2021-02-03 12:45

    If you want to fade between colours, work in a colourspace which makes it easy and then convert back to RGB at the end.

    For example, work in HSL colour space, keep S and L constant (say a fully saturated and bright colour) and then "fade" H around the circle - you'll go from red through green, blue and back to red. Convert back to RGB and then use those values for your LED drives. I used this technique for a "mood lamp" app, and other code for the colour space conversion can be found on SO.

    0 讨论(0)
提交回复
热议问题