I'm working on some code that controls 59 neopixels that represent minutes and 12 led panels that represent hours. after running my code for about half a day the teensy 3.1 I'm running it on will crash halfway through the reverse fade on the hour. This has happened 3 times so far. can you guys take a look at my code and see if im doing anything wrong that might cause the teensy to crash?
I'm pretty sure the below code is the issue but im not sure why
if (oldHour != Hour){ //checks to see if the hour has changed
for(int j=1; j != 61; j++){ //if the hour has changed start the for loop to reverse fade the minutes
for(int b=maxBrightness; b > 20; b = b - (maxBrightness/10)){ //dim the minute led before moving onto the next one
strip.setPixelColor(minuteLed [j], strip.Color(0,0,0,b));
strip.show();
}
strip.setPixelColor(minuteLed [j], strip.Color(0,0,0,0)); //set the last pixel completly to zero
strip.show();
delay(100);
}
int inverseBrightness = maxBrightness;
for (int j = 30; j != 103; j++){ //fade out the old hour led and in the new hour led
Brightness = pow (2, (j / R)) - 1;
delay(50);
analogWrite(hourLed [oldHour], inverseBrightness-Brightness);
if (Brightness < maxBrightness){
analogWrite(hourLed [Hour], Brightness);
}
}
delay(1000);
for(tapCount = 0 ; tapCount != Hour; tapCount++){ // if the gour has chaged tap for as many times as the hour is using the tap timed function
tap();
}
delay(500); //if we've tapped enough times wait a little bit and then run the spin fucntion while also reseting tapcount
tapCount = 0;
oldHour = Hour;
spin();
}
Chaotic_Clock.ino (8.47 KB)