I think I have a hardware problem (mostly cause the code looks to be too simple to have a problem and it’s been a decade or so since I soldered any microelectronics) because my Arduinos hang up after fairly short periods of time, but I’m honestly not sure what I’ve done wrong here. If you have a moment, please provide feedback on what I may have done.
So I’ve tried this combination of hardware and software with two different Arduino Micros both at 5V (16).
The only things on the breadboards are several decoupling caps and one small series resistor between the Arduinos output and the strip’s input. This problem occurs with or without these components. I added them to the setup in case noise and ringing were problems.
The problem has occurred from within 30 seconds to 30 minutes (without printlns) of when I have powered the Micros on for each of the 25 or so times this has happened. Adding printlns to debug seriously increases the amount of time it takes to hang up but when it does it seems to do so in the middle of the string being output. I’ve probably run it until crash 5 times with the printlns in there.
I have also run the below code with some Information libraries… unfortunately nothing appeared out of norms and perhaps more importantly nothing (free RAM, Internal Temperature) changed over time.
Here’s the code stripped down pretty far that still causes hangs:
#include <FastSPI_LED2.h>
#define NUMLEDS 180
struct CRGB leds[NUMLEDS];
struct CHSV ledCHSV;
void setup() {
// sanity check delay - allows reprogramming if accidently blowing power w/leds
delay(2000);
// For safety (to prevent too high of a power draw)
LEDS.setBrightness(64);
LEDS.addLeds<WS2811, 7, GRB>(leds, NUMLEDS);
// Serial.begin(115200);
}
void loop() {
DontKnowYet(1);
}
void DontKnowYet(int deltaHue){
ledCHSV.s = 255;
ledCHSV.v = 128;
for (int y = 0; y <256; y= y + deltaHue){
ledCHSV.h = y;
for (int x = 0; x <NUMLEDS; x++){
// Serial.println(“hsv2rgb_rainbow(ledCHSV, leds[x]); next”);
hsv2rgb_rainbow(ledCHSV, leds[x]);
// Serial.println(“hsv2rgb_rainbow(ledCHSV, leds[x]); finished”);
}
// Serial.println(“LEDS.show(); next”);
LEDS.show();
// Serial.println(“LEDS.show(); finished”);
}
}
