MCPcopy Create free account
hub / github.com/FastLED/FastLED / setup

Function setup

examples/Audio/simple/simple.h:115–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115void setup() {
116 Serial.begin(115200);
117 // auto screenmap = frameBufferXY.toScreenMap();
118 // screenmap.setDiameter(.2);
119 // FastLED.addLeds<NEOPIXEL, 2>(framebuffer,
120 // NUM_LEDS).setScreenMap(screenmap);
121 auto screenmap = ledsXY.toScreenMap();
122 screenmap.setDiameter(.2);
123
124 decayTimeSeconds.onChanged([](float value) {
125 audioFadeTracker.setDecayTime(value);
126 FL_WARN("Fade time seconds: " << value);
127 });
128 attackTimeSeconds.onChanged([](float value) {
129 audioFadeTracker.setAttackTime(value);
130 FL_WARN("Attack time seconds: " << value);
131 });
132 outputTimeSec.onChanged([](float value) {
133 audioFadeTracker.setOutputTime(value);
134 FL_WARN("Output time seconds: " << value);
135 });
136
137 // Initialize pitch detection
138 pitchConfig.sample_rate_hz = 44100.0f;
139 pitchEngine = new fl::SoundToMIDIEngine(pitchConfig); // ok bare allocation
140 pitchEngine->onNoteOn = [](uint8_t note, uint8_t velocity) {
141 currentMIDINote = note;
142 noteIsOn = true;
143 Serial.print("Note ON: ");
144 Serial.print(note);
145 Serial.print(" vel: ");
146 Serial.println(velocity);
147 };
148 pitchEngine->onNoteOff = [](uint8_t note) {
149 noteIsOn = false;
150 Serial.print("Note OFF: ");
151 Serial.println(note);
152 };
153
154 FastLED.addLeds<NEOPIXEL, PIN_DATA>(leds, ledsXY.getTotal())
155 .setScreenMap(screenmap);
156}
157
158void shiftUp() {
159 // fade each led by 1%

Callers

nothing calls this directly

Calls 11

setDiameterMethod · 0.80
setDecayTimeMethod · 0.80
setAttackTimeMethod · 0.80
setOutputTimeMethod · 0.80
getTotalMethod · 0.80
beginMethod · 0.45
toScreenMapMethod · 0.45
onChangedMethod · 0.45
printMethod · 0.45
printlnMethod · 0.45
setScreenMapMethod · 0.45

Tested by

no test coverage detected