FastLED 3.9.15
Loading...
Searching...
No Matches
EspI2SDemo.h
Go to the documentation of this file.
1// Simple test for the I2S on the ESP32dev board.
2// IMPORTANT:
3// This is using examples is built on esp-idf 4.x. This existed prior to Arduino Core 3.0.0.
4// To use this example, you MUST downgrade to Arduino Core < 3.0.0
5// or it won't work on Arduino.
6
7#ifdef ESP32
8
9
10
11#define FASTLED_ESP32_I2S
12#include <FastLED.h>
13
14// How many leds in your strip?
15#define NUM_LEDS 1
16
17// For led chips like WS2812, which have a data line, ground, and power, you just
18// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
19// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
20// Clock pin only needed for SPI based chipsets when not using hardware SPI
21#define DATA_PIN 3
22
23// Define the array of leds
25
26void setup() {
27 // Uncomment/edit one of the following lines for your leds arrangement.
28 // ## Clockless types ##
29 FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed
30}
31
32void loop() {
33 // Turn the LED on, then pause
34 leds[0] = CRGB::Red;
35 FastLED.show();
36 delay(500);
37 // Now turn the LED off, then pause
38 leds[0] = CRGB::Black;
39 FastLED.show();
40 delay(500);
41
42 // This is a no-op but tests that we have access to gCntBuffer, part of the
43 // i2s api. You can delete this in your own sketch. It's only here for testing
44 // purposes.
45 if (false) {
46 int value = gCntBuffer;
47 value++;
48 }
49}
50
51#else // ESP32
52
53// Non-ESP32 platform - provide minimal example for compilation testing
54#include <FastLED.h>
55
56#define NUM_LEDS 1
57#define DATA_PIN 3
58
60
61void setup() {
63}
64
65void loop() {
66 leds[0] = CRGB::Red;
67 FastLED.show();
68 delay(500);
69 leds[0] = CRGB::Black;
70 FastLED.show();
71 delay(500);
72}
73
74#endif // ESP32
CRGB leds[NUM_LEDS]
#define NUM_LEDS
#define DATA_PIN
void setup()
Definition EspI2SDemo.h:61
void loop()
Definition EspI2SDemo.h:65
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:74
central include file for FastLED, defines the CFastLED class/object
LED controller for WS2812 LEDs with GRB color order.
Definition FastLED.h:158
@ Red
<div style='background:#FF0000;width:4em;height:4em;'></div>
Definition crgb.h:679
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:567
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86