FastLED 3.10.6
Loading...
Searching...
No Matches

◆ setup()

void setup ( )

Definition at line 118 of file MoodRing.ino.

118 {
119 Serial.begin(115200);
120
121 FastLED.addLeds<WS2812, PIN_DATA>(leds, NUM_LEDS)
122 .setCorrection(TypicalLEDStrip)
123 .setScreenMap(screenmap);
124 FastLED.setBrightness(brightness.value());
125
126 // Route audio through FastLED.add() for auto-pump when available.
127 // gAutoPump may only be true when FastLED.add() returned a live
128 // processor; otherwise loop() would skip the manual pump and the
129 // listener would never see a sample.
130 auto input = audio.audioInput();
131 if (input) {
132 gProcessor = FastLED.add(input);
133 if (gProcessor) {
134 gAutoPump = true;
135 fl::printf("MoodRing: audio routed via FastLED.add() (auto-pump)\n");
136 }
137 }
138 if (!gProcessor) {
140 gAutoPump = false;
141 fl::printf("MoodRing: audio using manual pump (fallback)\n");
142 }
143
145 gListener->begin();
146
147 Serial.println("MoodRing setup complete");
148}
CRGB leds[1]
fl::UIAudio audio("Audio Input")
#define NUM_LEDS
#define PIN_DATA
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
fl::ScreenMap screenmap
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::shared_ptr< mood_ring::RoomListener > gListener
Definition MoodRing.ino:114
bool gAutoPump
Definition MoodRing.ino:116
fl::shared_ptr< fl::audio::Processor > gProcessor
Definition MoodRing.ino:113
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
Definition color.h:15
void printf(const char *format) FL_NO_EXCEPT
shared_ptr< T > make_shared(Args &&... args) FL_NO_EXCEPT
Definition shared_ptr.h:414
#define Serial
Definition serial.h:304

References audio, brightness, FastLED, gAutoPump, gListener, gProcessor, leds, fl::make_shared(), NUM_LEDS, PIN_DATA, fl::printf(), screenmap, Serial, and TypicalLEDStrip.

+ Here is the call graph for this function: