Skip to content

SubBlade

NoSloppy edited this page Feb 3, 2020 · 9 revisions

SubBlade is used to split a string of pixels into multiple blades which can have their own styles. It takes three arguments:

 SubBlade(first_led, last_led, blade_definition)

Note the use of () instead of <>, as SubBlade is a regular function, not a template. If blade_definition is NULL, SubBlade() will use the blade definition from the previous call to SubBlade(). Since you can't have two blade definitions for the same string, you must use NULL to make multiple SubBlades refer to the same string of pixels.

Let's say we have a string that has one accent led, one 8-pixel battery indicator and then a 100-led blade. The blades[] array could then look something like this:

SubBlade(9, 108, WS281XBlade<109, bladePin, Color8::GRB>()),
SubBlade(0, 0, NULL),
SubBlade(1, 8, NULL),

Note that the first LED in the string is counted as zero, so there's always a -1 offset to your numbers to the actual pixels as you'd count them.

Clone this wiki locally