I have a 144 LED strip - Adafruit NeoPixel Digital RGB LED Strip 144 LED, link here: https://www.adafruit.com/product/1507
If I create a simple project, eg turning pixels on off from the serial connection, then everything works fine. But when I build a solution with an ethernet jack and acting as a http server and lots more code, as soon as I try to show the strip then random pixels light up in random colours.
I know the code is logically ok because if I run it to eg print a string to the serial port, "Turning pixels 0-71 green" the code works.
There are 762 lines of code and quite a few global variables defined.
When I compile I see:
Sketch uses 19180 bytes (59%) of program storage space. Maximum is 32256 bytes. Global variables use 1462 bytes (71%) of dynamic memory, leaving 586 bytes for local variables. Maximum is 2048 bytes.
I did previously see build messages warning of instability due to size of global variables which I cut down and at least don't see the instability warning now. Could it be that the code is using too many resources? Any tips of reducing the code and / or use of global variables?
I am powering via the USB cable. The unit is an Arduino Uno -the Arduino starter kit. Could it be a power issue?
I have a 470ohm resistor on the data line into pin 6. And a 1000uF capacitor between 5V+ and ground. Anything else that could help?
I am using the Neopixel library to control the led strip: https://github.com/adafruit/Adafruit_NeoPixel