Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Advice on a 5 LED count down
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Advice on a 5 LED count down

by cronemike on Sun Dec 29, 2019 10:32 pm

I am looking for advice on a project.

I am wanting to push a button and have 5 leds turn on and then slowly turn off. Like one every 5 seconds.

I was thinking Neopixels.

cronemike
 
Posts: 10
Joined: Tue Jan 07, 2014 9:07 pm

Re: Advice on a 5 LED count down

by adafruit_support_bill on Mon Dec 30, 2019 7:04 am

Yes. Neopixels would be a reasonable way to do that. And you don't need a very powerful processor either. The Trinket M0 would be my choice: https://www.adafruit.com/product/3500

adafruit_support_bill
 
Posts: 78214
Joined: Sat Feb 07, 2009 10:11 am

Re: Advice on a 5 LED count down

by bcochran1 on Mon Dec 30, 2019 11:22 pm

Hi!

I second the use of a Trinket M0. I have a project being driven by an older Trinket 5v device. It drives 8mm Neopixel diffuse through-hole LEDs (product ID 1734) which are arranged in a grid. In fact, I have a Trinket M0 on order because I want to replace the Trinket 5V. Nothing is physically wrong with the Trinket 5V...it is just time to move on to the M0.

My advice is: set up a Trinket M0. Use it to turn on just one LED -- any old LED will do. Try doing it in CircuitPython and then again in Arduino so you start to get experience with both languages. When that is done, move the LED aside. Change over to NeoPixels. Connect a through-hole NeoPixel to the Trinket and blink it first in the color red, then in green, then in blue. When that works, move on to two (2) Neopixels -- connect them together. When that works, move on to three (3) NeoPixels, and so on.

At that point you should have some experience with the physical connections and the coding needed, and you can add a pushbutton switch and program a light show as you wish.

Thanks so much

Bob

bcochran1
 
Posts: 474
Joined: Mon Jan 21, 2013 10:46 pm

Re: Advice on a 5 LED count down

by Fishe on Tue Jan 07, 2020 8:10 pm

I am new to neopixels and looking to do something similar.

What simple code do I need to turn on one pixel

Setcolor
Fill

Looking to use on a RC car for headlight etc.

Fishe
 
Posts: 17
Joined: Mon Apr 25, 2016 8:50 pm

Re: Advice on a 5 LED count down

by adafruit_support_bill on Tue Jan 07, 2020 9:05 pm

Check out the example code in the library for how to initialize the library.

To set the color of one pixel, use the setPixel command:

strip.setPixelColor(n, red, green, blue);

Then call strip.show() to show all the pixels.

adafruit_support_bill
 
Posts: 78214
Joined: Sat Feb 07, 2009 10:11 am

Re: Advice on a 5 LED count down

by Fishe on Tue Jan 07, 2020 9:18 pm

That much I got, but what if I only what to show pixel #5 and keep the others off.

Fishe
 
Posts: 17
Joined: Mon Apr 25, 2016 8:50 pm

Re: Advice on a 5 LED count down

by adafruit_support_bill on Tue Jan 07, 2020 11:53 pm

By default, the pixels are initialized to off. If you want to explicitly turn one off, call:

strip.setPixelColor(n, 0, 0, 0);

adafruit_support_bill
 
Posts: 78214
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.