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

Function setup

examples/FestivalStick/old.h:159–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159void setup() {
160 pinMode(PIN_GRND, OUTPUT);
161 digitalWrite(PIN_GRND, LOW); // Set ground pin to low
162 button.addRealButton(Button(PIN_BUTTON));
163 screenMap = makeScreenMap(args);
164 //screenMap = fl::ScreenMap::Circle(NUM_LEDS, 1.5f, 0.5f, 1.0f);
165 auto controller = addController();
166 // Set the screen map for the controller
167 controller->setScreenMap(screenMap);
168
169 // Set power management. This allows this festival stick to conformatable
170 // run on any USB battery that can output at least 1A at 5V.
171 // Keep in mind that this sketch is designed to use APA102HD mode, which will
172 // result in even lowwer run power consumption, since the power mode does not take
173 // into account the APA102HD gamma correction. However it is still a correct upper bound
174 // that will match the ledset exactly when the display tries to go full white.
175 FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS, MAX_AMPS * 1000);
176 // set brightness 8
177 FastLED.setBrightness(brightness.as_int());
178 button.onChanged([](fl::UIButton& but) {
179 // This function is called when the button is pressed
180 // If the button is pressed, show the generative pattern
181 if (but.isPressed()) {
182 FL_WARN("Button pressed");
183 } else {
184 FL_WARN("NOT Button pressed");
185 }
186 });
187
188}
189
190
191void showGenerative(uint32_t now) {

Callers

nothing calls this directly

Calls 11

addControllerFunction · 0.85
addRealButtonMethod · 0.80
makeScreenMapFunction · 0.70
pinModeFunction · 0.50
digitalWriteFunction · 0.50
ButtonClass · 0.50
setScreenMapMethod · 0.45
setBrightnessMethod · 0.45
as_intMethod · 0.45
onChangedMethod · 0.45
isPressedMethod · 0.45

Tested by

no test coverage detected