I have an arduino UNO hooked up to a neopixel LED strip with 148 lights. Most of the time it works fine, but when I upload a program that changes the brightness frequently, particularly when I increase brightness, only the first 8 LEDs continue responding. The rest get stuck.
Here's an example of the kind of code that sets this issue off. To fix it, I usually have to restart the lights and the arduino and sometimes upload a blank program to the arduino.
I'm pretty new to arduino programming so and help would be really appreciated. Thank you.
#include "FastLED.h"
FASTLED_USING_NAMESPACE
// FAST LED definitions
#define DATA_PIN 3
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#define NUM_LEDS 148
CRGB leds[NUM_LEDS];
#define DATA_PIN 3 // Output Pin to Data Line on Strip
int fadeAmount = 5;
int brightness = 0;
void setup()
{
FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
}
void loop()
{
for(int i = 0; i < NUM_LEDS; i++ )
{
leds[i].setRGB(0,255,0);
leds[i].fadeLightBy(brightness);
}
FastLED.show();
brightness = brightness + fadeAmount;
// reverse the direction of the fading at the ends of the fade:
if(brightness == 0 || brightness == 255)
{
fadeAmount = -fadeAmount ;
}
delay(20);
}