I have some trouble with my code, and am thinking it’s in how I call libraries. This is my first C++ code, so I’m not really sure where it’s going wrong or maybe even what I should be doing. I’ve mostly been copying and pasting parts I found online (only parts that I understood!) (I do work a lot in MatLab though, so it’s more a lack of knowledge on the syntax rather than logical thinking, or so I’d like to think)
Code:
Errors after checking:
Originally I only had it to include “FastLED.h” and “ArduinoSTL.h”, but after adding them via Sketch → Include → Library, a lot of other stuff was added that I don’t dare remove at the moment.
If relevant, the idea of the code is to create a random blinking pattern on my 10x10 WS2812B grid.
Step 1: Select X random LEDs that should change, the rest stays the same this loop.
Step 2: Of the X LEDs, select Y which will change color, and (X-Y) that will turn off.
Step 3: Change colors of relevant LEDs and wait 1 sec.
Hope someone can help me out, but be sure to point out when I’m in the wrong place for these kinds of questions
I just ran this sketch with some minor modifications on my 8X8 WS2812B matrix and it looks nice. You can change various variables like TWINKLE_SPEED, TWINKLE_DENSITY and SECONDS_PER_PALETTE to get the effects you want. Also, you can learn how to use palettes to get the colors you want.
@Sven_vB You should be able to delete all those includes that got added to the top of your sketch except the FastLED one and the arduinoSTL one you originally had (although I’m not sure what that one is for. You can always comment it out and see if things still work.)
Thanks a lot @Ken_White , TwinkleFox looks really great and I’m sure to try and figure out the code and add some own pallets too
In the meantime I figured out the errors were caused by me running a too old version of the arduino program on my computer. Updating it fixed the errors (although I still have no output with my own code, but that’s for another time - Twinkle is great!)
Btw, @marmil , the arduinoSTL was added so I could use the vectors and random shuffle.