FastLED 3.9.15
Loading...
Searching...
No Matches
Esp32S3I2SDemo.ino
Go to the documentation of this file.
1
2
26// ArduinoIDE
27// Should already be enabled.
28//
29// PLATFORMIO BUILD FLAGS:
30// Define your platformio.ini like so:
31//
32// PlatformIO
33// [env:esp32s3]
34// platform = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.20/platform-espressif32.zip
35// framework = arduino
36// board = seeed_xiao_esp32s3
37
38
39#define FASTLED_USES_ESP32S3_I2S // Must define this before including FastLED.h
40
41#include "FastLED.h"
42#include "fl/assert.h"
43
44
45#define NUMSTRIPS 16
46#define NUM_LEDS_PER_STRIP 256
47#define NUM_LEDS (NUM_LEDS_PER_STRIP * NUMSTRIPS)
48
49// Note that you can use less strips than this.
50
51#define EXAMPLE_PIN_NUM_DATA0 19 // B0
52#define EXAMPLE_PIN_NUM_DATA1 45 // B1
53#define EXAMPLE_PIN_NUM_DATA2 21 // B2
54#define EXAMPLE_PIN_NUM_DATA3 6 // B3
55#define EXAMPLE_PIN_NUM_DATA4 7 // B4
56#define EXAMPLE_PIN_NUM_DATA5 8 // G0
57#define EXAMPLE_PIN_NUM_DATA6 9 // G1
58#define EXAMPLE_PIN_NUM_DATA7 10 // G2
59#define EXAMPLE_PIN_NUM_DATA8 11 // G3
60#define EXAMPLE_PIN_NUM_DATA9 12 // G4
61#define EXAMPLE_PIN_NUM_DATA10 13 // G5
62#define EXAMPLE_PIN_NUM_DATA11 14 // R0
63#define EXAMPLE_PIN_NUM_DATA12 15 // R1
64#define EXAMPLE_PIN_NUM_DATA13 16 // R2
65#define EXAMPLE_PIN_NUM_DATA14 17 // R3
66#define EXAMPLE_PIN_NUM_DATA15 18 // R4
67
68
69// Users say you can use a lot less strips. Experiment around and find out!
70// Please comment at reddit.com/r/fastled and let us know if you have problems.
71// Or send us a picture of your Triumps!
90
92
93void setup_i2s() {
94 // Note, in this case we are using contingious memory for the leds. But this is not required.
95 // Each strip can be a different size and the FastLED api will upscale the smaller strips to the largest strip.
98 );
101 );
104 );
107 );
110 );
113 );
116 );
119 );
122 );
125 );
128 );
131 );
134 );
137 );
140 );
143 );
144}
145
146
147
148void setup() {
149 // put your setup code here, to run once:
150 Serial.begin(57600);
151
152 // This is used so that you can see if PSRAM is enabled. If not, we will crash in setup() or in loop().
153 log_d("Total heap: %d", ESP.getHeapSize());
154 log_d("Free heap: %d", ESP.getFreeHeap());
155 log_d("Total PSRAM: %d", ESP.getPsramSize()); // If this prints out 0, then PSRAM is not enabled.
156 log_d("Free PSRAM: %d", ESP.getFreePsram());
157
158 log_d("waiting 6 seconds before startup");
159 delay(6000); // The long reset time here is to make it easier to flash the device during the development process.
160
161 setup_i2s();
162 FastLED.setBrightness(32);
163
164}
165
166void fill_rainbow(CRGB* all_leds) {
167 static int s_offset = 0;
168 for (int j = 0; j < NUMSTRIPS; j++) {
169 for (int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
170 int idx = (i + s_offset) % NUM_LEDS_PER_STRIP + NUM_LEDS_PER_STRIP * j;
171 all_leds[idx] = CHSV(i, 255, 255);
172 }
173 }
174 s_offset++;
175}
176
177void loop() {
179 FastLED.show();
180
181}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
#define EXAMPLE_PIN_NUM_DATA2
#define EXAMPLE_PIN_NUM_DATA11
#define EXAMPLE_PIN_NUM_DATA8
#define NUM_LEDS_PER_STRIP
#define EXAMPLE_PIN_NUM_DATA6
#define EXAMPLE_PIN_NUM_DATA0
#define EXAMPLE_PIN_NUM_DATA12
void setup()
#define EXAMPLE_PIN_NUM_DATA15
void fill_rainbow(CRGB *all_leds)
#define EXAMPLE_PIN_NUM_DATA4
#define EXAMPLE_PIN_NUM_DATA9
#define EXAMPLE_PIN_NUM_DATA5
#define EXAMPLE_PIN_NUM_DATA7
#define NUMSTRIPS
#define EXAMPLE_PIN_NUM_DATA13
#define EXAMPLE_PIN_NUM_DATA10
#define EXAMPLE_PIN_NUM_DATA1
void setup_i2s()
#define EXAMPLE_PIN_NUM_DATA14
int PINS[]
#define EXAMPLE_PIN_NUM_DATA3
void loop()
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:62
central include file for FastLED, defines the CFastLED class/object
WS2812 controller class.
Definition FastLED.h:210
@ GRB
Green, Red, Blue (0102)
Definition eorder.h:17
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition chsv.h:16
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:55