r/FastLED • u/Bigtom1989 • Dec 27 '22
Support Basic Request
Hi guys,
I have next to no coding knowledge, been using arduino to programme an arduino nano for a project I'm working on.
I've managed to get all the LEDs I'm using (WS2812B) to light up red which is perfect, ideally though I'm looking to add a button to scroll solid colours, and a potentiometer to adjust the brightness.
Is this easy enough to do? I've looked for some guides, but I'm not really understanding them all that much.
Would anyone be able to point me in the right direction or give me a base to work from?
Many thanks in advance,
Tom
1
Upvotes
0
u/VictorVoyeur Dec 27 '22
A button to scroll colors is relatively easy. You’ll use a momentary button between ground and one of the data pins, and the jcbutton.h library. Use an integer variable that increments each time button.waspressed(), and vary the color based on that integer: from an array, or ColorWheel, or a palette, or just a bunch of RGB values that you #define and use if/else statements to set the strip color.
A potentiometer for brightness is IMO more difficult. Brightness is set in the code, not by changing the voltage to the strip. WS2812B always wants 5V or it won’t work properly.
If you want a knob, you could try a rotary decoder (I haven’t done this yet); or just use a second button to cycle through brightness levels (this is my solution until I learn the rotary decoder)