Trouble with Arduino Uno & APA102’s Freezing mid-loop
Using FastLED 3.1 and IRLib 1.51 and Arduino IDE 1.81
Code: https://pastebin.com/ZHK0KxMW
The Uno seems to freeze relatively quickly once the switch function changes the volup/voldown variable and the matching IF loops are activated. It maybe gets one cycle into the loop, sometimes more, sometimes less.
I tried using serial print to watch the value of both volup or voldown separately, and I see that once either has been changed to 1, the entire loop runs what seems like 10’s or 100’s of times faster, printing out 1’s far more frequently than the 0’s print.
Then, randomly, without an exact repeatable spot, the whole thing stops printing, the loop appears to stop, and the lights freeze. Other separate sketches run fine, so I know my Uno isn’t broken. Just seems like this sketch is somehow pushing its limits, even though either beatsin8 part runs fine on its own separate sketch
I am pretty new to all this, only started learning about 2 months ago with no (relevant) prior programming experience. So suggestions in the common mans tongue are appreciated!
Also, if anyone has better suggestions for IR loop control (or a resource I can research), I would like to continue building this sketch out to run multiple different loops off this controller, and I feel like there must be more efficient ways to control variables with the IR than the switch and pseudo-nested IF statements for the loops.
