This example demonstrates FastLED's parallel SPI output feature, which allows you to drive 2, 4, or 8 LED strips simultaneously instead of sequentially.
This example demonstrates FastLED's parallel SPI output feature, which allows you to drive 2, 4, or 8 LED strips simultaneously instead of sequentially. This can dramatically improve refresh rates for multi-strip installations.
How Parallel SPI Works: When multiple LED strips use clock-based chipsets (APA102, SK9822) with the SAME clock pin, FastLED automatically detects this and enables parallel output mode. The hardware sends data to multiple strips on different GPIO pins simultaneously, using a shared clock signal to synchronize them.
When to Use Parallel Output:
- You have 2+ strips of clock-based LEDs (APA102, SK9822, etc.)
- You need high refresh rates (>100 FPS with multiple strips)
- All strips use the same clock pin (hardware requirement)
- Sequential output is causing visible lag or tearing
Performance Expectations:
- 2 strips: Up to 2x faster than sequential
- 4 strips: Up to 4x faster than sequential
- 8 strips: Up to 8x faster than sequential Actual speedup depends on LED count and platform performance.
IMPORTANT - LED Chipset Requirements: ✓ SUPPORTED: APA102, SK9822 (clock-based SPI LEDs) ✗ NOT SUPPORTED: WS2812, WS2811, SK6812 (timing-based, no clock pin)
Hardware Setup:
- Connect each LED strip's DATA line to consecutive GPIO pins
- Connect ALL strips' CLOCK lines to the SAME GPIO pin
- Sharing the clock pin is what triggers parallel mode
ESP32 GPIO Pin Recommendations: For ESP32, avoid strapping pins (0, 2, 15) and input-only pins (34-39). Good choices for data pins: 4, 5, 12-14, 16-19, 21-23, 25-27, 32-33 Good choices for clock pin: 18, 19, 23 (default SPI pins)
Configuration Below: Edit NUM_STRIPS, NUM_LEDS, and pin assignments to match your hardware.
Platform Support:
- ESP32 (all variants: C3, C2, C6, S2, S3, etc.)
- Host simulation (for testing)
- Other platforms with SPI hardware support
#define NUM_STRIPS 2
#define NUM_LEDS 30
#define LED_CLOCK_PIN 18
#define LED_DATA_PIN_0 4
#define LED_DATA_PIN_1 5
#define LED_DATA_PIN_2 12
#define LED_DATA_PIN_3 13
#define LED_DATA_PIN_4 16
#define LED_DATA_PIN_5 17
#define LED_DATA_PIN_6 21
#define LED_DATA_PIN_7 22
#include <FastLED.h>
#if defined(FASTLED_STUB_PLATFORM)
#if NUM_STRIPS != 2 && NUM_STRIPS != 4 && NUM_STRIPS != 8
#error "NUM_STRIPS must be 2, 4, or 8"
#endif
#if !defined(FASTLED_SPI_HOST_SIMULATION) && !defined(ESP32)
#error "This example requires ESP32 or host simulation platform"
#endif
delay(2000);
Serial.println(
"FastLED Parallel Output Example");
Serial.println(
"================================");
Serial.print(
"Number of strips: ");
Serial.print(
"LEDs per strip: ");
Serial.print(
"Clock pin: GPIO");
#if NUM_STRIPS >= 2
#endif
#if NUM_STRIPS >= 4
#endif
#if NUM_STRIPS >= 8
#endif
Serial.println(
"================================");
Serial.println(
"Setup complete!");
}
}
#if NUM_STRIPS >= 2
#endif
#if NUM_STRIPS >= 4
#endif
#if NUM_STRIPS >= 8
}
}
}
#endif
if (elapsed > 0) {
uint32_t fps = (frameCount * 1000) / elapsed;
frameCount = 0;
lastTime = now;
}
frameCount++;
}
}
#else
#endif
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
@ APA102
APA102 LED chipset.
void fill_rainbow(CRGB *targetArray, int numToFill, fl::u8 initialhue, fl::u8 deltahue=5) FL_NOEXCEPT
Fill a range of LEDs with a rainbow of colors.
void fill_solid(CRGB *targetArray, int numToFill, const CRGB &color) FL_NOEXCEPT
Fill a range of LEDs with a solid color.
LIB8STATIC fl::u8 random8() FL_NOEXCEPT
Generate an 8-bit random number.
#define EVERY_N_MILLISECONDS(N)
Alias for EVERY_N_MILLIS.
LIB8STATIC u8 beatsin8(accum88 beats_per_minute, u8 lowest=0, u8 highest=255, u32 timebase=0, u8 phase_offset=0) FL_NOEXCEPT
Generates an 8-bit sine wave at a given BPM that oscillates within a given range.
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>