Im about to start a project where I want to control 36 indiviual leds, based on an input value (on/off)
Hardware wise I was thinking about getting an rgb ledstrip and program every indiviual led.
I know fastled is a common used library, but I am wondering what library is best for controlling indiviual leds on a ledstrip?
As did I, until I wrote my own minimalist function to avoid library overheads, etc.
However, as we've seen in threads on this forum, beginners get into trouble with FastLED with things like buffer indices out of bounds, for example.
If our OP is comfortable with indexing arrays, controlling for loop boundaries, etc. then that particular problem isn't relevant(I know there were other risks, but I don't recall what they were). Otherwise, the OP should expose their code here early and often, so that forum members can spot when the troubles begin.
Just one opinion. There will be others, no doubt!
Another consideration is the 'approach' each library takes (examine what functions are available, for example) - one may lend itself to the OP's needs more clearly, or readily, than others. Problem is, that evaluation itself may require a level of familiarity our OP does not yet have.
so you get DMX512 lighting data over IP and then you have a simple test to light up a led. Both libraries will be fine, Adafruit's will not crash if you try to address a LED that does not exist. With fastLed you need to ensure the led you want to target does exist within the bounds of the led array.
Usually an application with the Adafruit_Neopixel library will crash the application if you use too many pixels and run out of memory without being informed about it by the IDE.
36 RGB pixels will need 108 bytes so you need to add that to the reported memory usage and maker sure you stay within reasonable limits.
With the FastLED library the IDE will at least report the true memory usage.
I find that the Fast Led library confuses beginners, and they often get stuck selecting individual colours as there are so many ways of doing this. There are other difficulties as well basically because there are many ways to do most things.
Personally I find the Adafruit library the simplest to use on an Arduino.
For an AVR (UNO, Mega, Nano, Pro-mini etc. Adadfruit_Neopixel or fastLED will work just fine with minor differences
They both bit-bang the signal, (which is the only way really on those7 processors) and the vast majority of the processor time is spent doing that, and they both do it real-time from the pixel-buffer. I don'y think there is any difference in speed.
For an ESP (32 or 8266) Makuna Neopixelbus is the best in my opinion. It's I2S method is in the background making sure WiFi remains stable.
Other processors ? Probably again Neopixelbus, but FastLED will also have usable methods.
it depends on the pixels. If you go APA102 and the likes (my favorites) then the Adafruit NeoPixel library uses bit banging, while FastLED for APA102 uses hardware SPI when available, avoiding bit banging.
Yes, but I find them more friendly especially if you have lots of leds as they don’t lock interrupts for a long time which can create all sorts of issues with other equipment (IR command, motors, radio, gps serial frames,…)
Fair point.
That would happen too then in the case of static allocation since the total memory is what you play with, isn’t it ?
Yes but it can cause some confusion since the dynamic allocation can be quite big (3 bytes per LED) and does not get reported at compile time, but yes it can always happen.
This is of course only the case on an MCU that can not send the signal using one of it's peripherals. Hence i use ESP's mainly for this purpose, and the I2S bus in particular. (UART is also an option and even RMT on an ESP32, which in theory can also be used for reception of WS281x) The extra amount of memory available is just an added bonus. When using loads of LEDs the price becomes also more of an issue.