I have written the following code installed on my Uno, to run 53 WS2812B LEDs on a strip to act as a sequential indicator. The code uses an input from the indicator circuit (stepped down from 12v to 5v) to activate the sequence (called TurnSignal). There is also a "background" sequence (called DRL), which lights all the LEDs at a dull brightness to replicate US Daytime Running Lights. The code below worked perfectly when I had just 1 button (for the indicator sequence), and the DRLs were constantly on. However, I don't want it this way, because the Uno will be permanently powered in the car, so I don't want the DRLs permanently lit; the second button takes a signal from the cars ignition, so tells the DRLs to turn on whenever the car is on.
The issue I am having is that the DRL background sequence flashes on and off very quickly whilst button3 is pressed. Am I missing something obvious in the coding? Other than that it works perfectly!
While I'm bench testing, I have it set out as per the attached image, just running off the USB port. Once I have it working on the bench I will get it working properly with the 5v regulators on the supply, and on the inputs.
Such a strip draws about 60mA per LED. With 53 LEDs on the strip that's over 3A! My guess is that the power supply drops if all the LEDs have to be lit.
It works perfectly, other than the flashing with the DRL function button activated. If I change the code and have the DRL function running permanently, it works fine...it is only trying to operate it with the button that it is causing the strobing.
You read the button in each loop and you call the DRL function if the read returns LOW, but clear all LEDs if the button is reading HIGH. You do that for all buttons. Do you see the problem?
If button 2 is not pressed, you clear the LEDs in that round. If button 3 is pressed you draw the DRL function. So for each round the LEDs are clear and the lit again.
Change the code to only clear the LEDs if no button is pressed.
I desperately need help! This all is making my head spin.
I am trying to wire sequential turn signals and day runner for my spare wheel on the back of my jeep. I'll have 50 leds, and want the light to chase counter clockwise when turning left and chase clockwise when turning right. I have the 2811s both 12v and 5v and an allegro uno r3. I bought the starter kit but way over my head.