Not sure if this is the place to ask these questions - very sorry if it isn’t !
These questions are referring primarily to ws2812 / Neopixels etc used with nodemcu esp8266 and/ or Arduino Uno
The first one is if I’m working with an led matrix, is there any performance benefit (or the opposite ) between using algebra such as that in the xymatrix example to just manually declaring the entire matrix eg:
Uint8_t XY[] = {
0,1,2,3,77,78,79,80 etc etc}
I know the second option might sound long winded , but it would be easier for me to do that than work out the mathematical function I need every time …(the reason is that I already have csv documents that have my matrix data laid out already )
Secondly , aside from the ones in the FastLED and Neopixel examples and documentation , does anyone know of further tutorials explaining more about arrays and particularly using multiple panels together …?
It depends on which board you use. On a slow board like Uno where the flash memory runs at the same clock as the CPU, the lookup table is almost certainly faster.
On a fast processor, things are harder to predict. If the table is stored in slower flash memory, the processor suffers wait states to fetch the data, and sometimes some overhead for fetching data that’s not in sequence with the program’s instructions. If the math is simple and especially if it avoids if-else structure (just an equation - nothing that alters program flow, so the CPU’s pipeline stays filled) a fast processor may execute it more quickly than a table lookup.
@PaulStoffregen - oh! That’s good news as it’s the easier way for me - I wasn’t sure, as its obviously longer code in terms of how many items are explicitly described , but I’m assuming that it’s easier for the board to just look up a number rather than calculate it I guess?
Either way , it’s all working nicely now thanks so much