I’m looking for some help with a bit of code for ESPHome.
I have a NeoPixel ring (24 LEDs). I am using it as a gauge, splitting the ring into 6 separate sections, each of which are coloured independently. ie:
Color red(255,0,0);
it.range(0, 6) = red;
Color orange(255,128,0);
it.range(6,12) = orange;
Color yellow(255,255,0);
it.range(12,18) = yellow;
Color green(0,255,0);
it.range(18,24) = green;
This is working fine, and I have some code which sets the LEDs to BLACK to follow a percentage value that’s coming out of Home Assistant.
What I would like to do, is have the colours of the ring set as a gradient, rather than 6 discrete sections of colour. The gradient would be from Green (100%) through Yellow and Orange to Red.
Does anyone have a snippet of code that might point me in the right direction?
Thanks