Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!
[Solved] Turning on one neopixel at a time
(@malijn)
New Member
Joined: 7 years ago
Posts: 1
Topic starter
January 3, 2018 12:49 PM
Hi! I'm new to Arduino (and programming at all for that matter) and looking to do a project where I would like to address a 1m 60 neopixel strip (WS2812b) individually, using a button (arcade type). What I would like to achieve is: the first button push lights up the first pixel, the second button push lights up the second (first pixel still on), third button push lights up the third pixel (first and second pixels still lighted up)...etc, when all 60 pixels are lighted up, push 61 should make it reset (all lights turns to off) and then I would like the count to start over..
I've been browsing around trying to find some info on this and a good way to start...but haven't been successful. Maybe I've looked in the wrong places. If anyone could give me some input I would be so grateful and so so happy :D
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
January 21, 2018 9:55 AM
The easiest way is to set all LEDs to black, then set the LED you want lit, and the call the procedure to show the changes. Depends on what you're using (I'd recommend FastLED).
In FastLED, set all pixels to black:
for(int i = 0; i < NUM_LEDS; i++ ) {
setPixel(i, 0, 0, 0);
}
Set the 5th LED to red:
SetPixel(4,255,0,0);
And now show it:
FastLED.show();
Hope this is what you're looking for or get you started