Rainbow Cycle - AlbertGBarber/PixelSpork GitHub Wiki
See the Documentation Guide for help understanding each page section.
Effect Sample (see here for sample info) |
![]() |
A classic effect.
Moves repeating rainbows of a set length along the segment set in a set direction. Suggested min length is 5 (ie red, yellow, green, blue, indigo/violet).
This is the 1D version of the effect. See Rainbow Cycle (Seg Line or Seg) for a 2D version.
Comparing the two may help you learn how drawing on segment lines works.
RainbowCyclePS rainbowCycle(mainSegments, 30, true, 80);
//Will draw rainbows of length 30, moving towards the end of the Segment Set, at 80ms
RainbowCyclePS rainbowCycle(mainSegments, true, 80);
//Will draw rainbows of length 255
//(the length is set to 255 by default b/c it is omitted from the constructor),
//moving towards the end of the Segment Set, at 80ms
//Using a default rainbow length of 255:
RainbowCyclePS(SegmentSet &SegSet, bool Direct, uint16_t Rate);
//Adding length as an input:
RainbowCyclePS(SegmentSet &SegSet, uint16_t Length, bool Direct, uint16_t Rate);
-
SegmentSetPS* segSet -- The Segment Set the effect will draw on. See common vars
segSet
entry for more details. -
uint16_t length (optional) -- The length of each rainbow, if omitted, the rainbow will be set to the default of 255. Any value above 255 will "stretch" the rainbow b/c it only has 255 unique colors. Can be changed later using
setLength()
. -
bool direct -- The direction the rainbows will move in (true is forward).
-
uint16_t* rate -- Update rate (ms). Is a pointer, allowing you to bind it to an external variable. By default it's bound the effect's local variable,
rateOrig
. See common varsrate
entry for more.
-
uint8_t sat (default 255) -- HSV rainbow saturation value. See Common Vars "sat and hue" entry for more.
-
uint8_t val (default 255) -- HSV rainbow "value" value. See Common Vars "sat and hue" entry for more.
-
bool showNow (default true) -- Controls if the effect "draws" during each update cycle by calling
FastLED.show()
. Common to all effects. See common varsshowNow
entry for more details.
-
void setLength(uint16_t newLength);
Sets a new rainbow length.
-
void update();
Updates the effect .
- uint16_t length -- The length of the rainbow. Set using
setLength()
.