FastLED 3.10.6
Loading...
Searching...
No Matches
MultipleEsp32SpiBuses.ino

Demonstrates selecting the SPI host per controller, so two clocked strips can run on independent hardware buses instead of sharing one.

Demonstrates selecting the SPI host per controller, so two clocked strips can run on independent hardware buses instead of sharing one.

// @filter: (platform is esp32)
#include <FastLED.h>
// The @filter above keeps discovery-driven builds from picking this sketch up
// off ESP32 at all. The guard below is the belt to that suspenders: an explicit
// `uno all` compiles every sketch regardless of filter, and an ESP32-only
// sketch has to compile away to nothing there rather than `#error` out, or the
// build reports what looks like a toolchain problem rather than an example that
// was never meant for AVR.
#if defined(ESP32)
CRGB spi2Leds[8];
CRGB spi3Leds[8];
void setup() {
FastLED.addLeds<APA102, 11, 12, RGB, DATA_RATE_MHZ(20)>(
spi2Leds, 8, fl::Esp32SpiBus::HOST2);
FastLED.addLeds<APA102, 13, 14, RGB, DATA_RATE_MHZ(20)>(
spi3Leds, 8, fl::Esp32SpiBus::HOST3);
}
void loop() {
FastLED.show();
}
#else
void setup() {}
void loop() {}
#endif // defined(ESP32)
void setup()
void loop()
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
constexpr EOrder RGB
Definition eorder.h:17
@ APA102
APA102 LED chipset.
Definition FastLED.h:304
#define DATA_RATE_MHZ
Definition fastspi.h:95
fl::CRGB CRGB
Definition crgb.h:25