FastLED
FastLED is een open-source softwarebibliotheek voor het aansturen van adressable LED's, zoals WS2812B (NeoPixels), SK6812, APA102 (DotStar), en andere RGB-LED's. De bibliotheek is geoptimaliseerd voor prestaties en biedt een eenvoudige API voor het creëren van complexe lichtpatronen, animaties en effecten. FastLED wordt veel gebruikt in DIY-elektronica, lichtkunst, wearables en interactieve installaties.
Kenmerken
FastLED onderscheidt zich door:
- Hoge prestaties en efficiënt geheugengebruik
- Brede compatibiliteit met verschillende microcontrollers
- Ondersteuning voor kleurcorrectie, gamma-correctie en kleurpaletten
- Actieve community met veel voorbeelden en uitbreidingen
Ondersteunde LED-types
| Type | Protocol | Opmerkingen |
|---|---|---|
| WS2812B | NeoPixel | Meest gebruikte adressable LED |
| SK6812 | NeoPixel | RGBW-variant met witte LED |
| APA102 | DotStar | Sneller protocol, vereist kloklijn |
| WS2801 | Vereist kloklijn | |
| LPD8806 | Lagere kleurdiepte, vereist kloklijn |
Installatie
FastLED kan geïnstalleerd worden via de Arduino Library Manager:
- Open de Arduino IDE
- Ga naar Sketch > Include Library > Manage Libraries
- Zoek naar "FastLED" en installeer de nieuwste versie
Voor handmatige installatie kan de bibliotheek gedownload worden van de [officiële GitHub-pagina](https://github.com/FastLED/FastLED).
Basisgebruik
Om FastLED te gebruiken, voeg je de volgende code toe aan je Arduino-sketch:
#include <FastLED.h>
#define NUM_LEDS 60
#define DATA_PIN 6
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
}
void loop() {
// Alle LED's rood maken
fill_solid(leds, NUM_LEDS, CRGB::Red);
FastLED.show();
delay(30);
}
Geavanceerde functionaliteit
FastLED biedt geavanceerde functies zoals:
- Kleurpaletten voor animaties
- Noise-functies voor organische effecten
- Power management om overbelasting te voorkomen
- Ondersteuning voor meerdere LED-stroken
Voorbeeld: Regenboog-animatie
void loop() {
static uint8_t hue = 0;
fill_rainbow(leds, NUM_LEDS, hue++, 7);
FastLED.show();
delay(10);
}
Externe links
- [Officiële website](https://fastled.io/)
- [GitHub-repository](https://github.com/FastLED/FastLED)
- [FastLED Wiki](https://github.com/FastLED/FastLED/wiki)
- [FastLED voorbeelden](https://github.com/FastLED/FastLED/tree/master/examples)