-
Notifications
You must be signed in to change notification settings - Fork 0
Code Description
Declare and include libraries #include <Arduino.h> #include <AsyncDelay.h> #include "Headers.h" #include "Patterns.h"
Include Sensors:
#include <ZX_Sensor.h>
Specify the pin that you are getting input from
pinMode(Pin, INPUT);
delay(3000);
Tell FastLED about the LED strip configuration
FastLED.addLeds<LED_TYPE,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
set master brightness control
FastLED.setBrightness(10);
"BGi 20 20 20 0 169" BGi is the pattern name we are calling.
Then "20 20 20" are the RGB colors we want to use, the range is "0~255".
"0 169" is the start position and the length of the light (patterns). Note that the total length is 169
Using a dynamic array, store the instance in the array.
In the void loop()
function, we loop through the array to see which patterns are enabled and display them.
typedef void (*SimplePatternList[])();
SimplePatternList gPatterns = { BGi, HSv, rainbow, ticks, drumKit, ARGB, fairyFire, funfetti, bell, mouth, addGlitter };
Check to see if each pattern in array is enabled
Call the current pattern if enabled, updating the 'leds' array
for(int i : gPatterns){ if(patternEnArray[i]) gPatternsi; }
Create the class of "BGi"
Class bgi. Public: void callPattern();
void bgi::callPattern(): fillsolid(...);
Then declare and create instance;
bgi b1; b1.callPattern();
fill_solid( &(leds[BGiParams[3]]), BGiParams[4], CRGB( BGiParams[0], BGiParams[1], BGiParams[2]) );
FastLED color library: Click this for more information
Fill rainbow: fill_rainbow( &(leds[BOWParams[1]]), BOWParams[2], gHue, BOWParams[0]);