Encountering my first serious error and how I solved it
So far I have put all my LED strip code on an old Arduino uno, and all the Wifi related code on a newer Arduino. I assumed that the library of the leds was also going to work on the new Arduino... (Drinking game suggestion: take a shot everytime I say Arduino)
Because the led installation is large and difficult to move I work on this downstairs in the garage with a separate Arduino Uno. All other work for my passion project I do in my room with a newer Arduino Uno Wifi. I always assumed that the led library (which is essential) was also going to work with the new Ardiuno. When I tested this for the first time today, it turned out not to be the case.
After long debugging and changing parameters in the Arduino IDE it comes down to the fact that the led library (from 2015) doesn't work well with the newer Arduino (released in 2018). Specifically, there is a problem with compibalitity with the hardware SPI ports and protocols of the new Atmega4809 chip. The new megaAVR-0 series have different registers than the 'classic' AVRs found on the Arduino Uno
I must admit that at first I panicked a little. The compile error was not due to an error of mine, but rather a library or hardware problem. And I did need to be able to control my LEDs with the newer Wifi board, because all the backend and WiFi communication was already done.
Through this test, I saw that a few more letters could be improved. This is what my arrays look like. There is an array with the LEDs per letter, and an array within an array where you can also choose the color separately for each LED.
I saw three solution: to the problem:
1) Change whole my backend and wifi configuaration and put an ethernet shield on the old Arduino Uno. And start again to figure out everything about the WiFi connectivity with the Ethernet shield. It is a disadvantage that the tree will always need an internet cable.
2) Connect the Old Arduino to the newer Atmega4809 board using the I2C protocol. (slave and master Arduino)
3) Commenting out the function in the library that causes the compile error. Found as a tip online, but has not been proven yet and there is a chance this will damage the chips in the LEDs.
The only reason why I didn't go for option three (because this seems to be the easiest option) was because I can't afford to damage the lights. I wanted to wait for a coaching session before making a decision. Simon said I should try it.
A wise programmer once told me: 'there are three ways to solve an error: you can solve it, you can accept it, or you can ignore it'. In this case I choose the last option. He also said: 'Alst werkt, moeje ervan blijven'
I searched for the function in the library which caused the error, commented it out and tried to compile it. It worked and they lived happily ever after.