I am working on a project where I am required to work with a WS2812B LED strip that has 360 LEDs. I am using Adafruit_NeoPixel.h
library to drive the LED strip. I have a class called lights which are responsible for driving the LEDs.
Here is a snippet of my code:
//---- in Lights.h
private:
Adafruit_NeoPixel m_LedStrip;
//----------------------------------------
//--- in Lights.cpp
Lights::Lights()
{
m_LedStrip = Adafruit_NeoPixel(360, m_LedPin, NEO_GRB + NEO_KHZ800);
#if defined (__AVR_ATtiny85__)
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
m_LedStrip.begin();
Serial.print("m_LedStrip.numPixels() is ");
Serial.println(m_LedStrip.numPixels());
}
//----------------------------------------
I am working on Arduino Nano w/ATmega328 by the way.
Now, m_LedStrips.numPixels()
shows that it have 0 pixels. Strangely it works when I put the number of pixels to something smaller. 360 also works on my prototype code that only has lights control. I suspect that this might be a memory issue but my Arduino memory is not even full. Here are the memory usage stats.
Program size: 9,186 bytes (used 30% of a 30,720 byte maximum) (1.64 secs)
Minimum Memory Usage: 928 bytes (45% of a 2048 byte maximum)
Can someone give some advice as to how I can fix this issue?