Hi everyone!
I’m trying to make a single “blade” out of 3 white LEDs i have in a saber build. I figured grouping them together may be easier than coding each one separately. I’ve done some digging around the documentation and have found mentions of a 6segment stringblade, so surely a 3 segment one should be possible too, right?
Each LED has a 100ohm resistor on it, and are wired independently of each other, the first one to powerPin4, second to powerPin5 etc.
How exactly would one code this for the blade config in order to work? I cant imagine coding them separately would be very pretty or practical, just trying to find some other workaround to make things simpler.
Thanks in advance!
What sort of white LEDs are you talking about. Just like a tri-cree, but the three are white?
I would just copy the same style three times. But, I would ask @profezzorn if something like:
BladeConfig blades[] = {
{ 0, SimpleBladePtr<CreeXPE2WhiteTemplate<550>, CreeXPE2WhiteTemplate<550>, CreeXPE2WhiteTemplate<550>, NoLED, bladePowerPin1, bladePowerPin2, bladePowerPin3, -1>(), CONFIGARRAY(presets) },
};
would work.
Put this before the blade array:
template<class LED>
class BladeBase *TriBladePtr() {
static Simple_Blade<
PWMPin<bladePowerPin1, LED>,
PWMPin<bladePowerPin2, LED>,
PWMPin<bladePowerPin3, LED>,
> blade;
return &blade;
}
(Replace bladePowerPin1/2/3 with the pins you’re actually using.)
Then in the blade array, use it like:
BladeConfig blades[] = {
{ 0,
/* put regular blade here */
TriBladePtr<CreeXPE2WhiteTemplate<550>>(),
CONFIGARRAY(presets) },
};
It’s just a slightly modified version of the stringblade function template.
The CreeXPE2WhiteTemplate will work, but you could also create a specialized LED template for your LEDs if you need it.
Tried this, Fredrik, but got an error when compiling, would you mind checking my config file?
Looks reasonable, what error did you get?
I think it’s an extra comma, try this:
template<class LED>
class BladeBase *TriBladePtr() {
static Simple_Blade<
PWMPin<bladePowerPin1, LED>,
PWMPin<bladePowerPin2, LED>,
PWMPin<bladePowerPin3, LED>
> blade;
return &blade;
}
slightly better, but still got this error:
These are independent errors.
The first one is caused by using auxButtonPin
, instead of auxPin
.
The second one is caused by using a style that generates transparent colors. ProffieOS needs styles to generate solid colors.
ok, i think i found the culprit, but i dont quite understand it being a transparent style? what is causing that?
Glad you came to the right place for the answwer on your string blade 
See the PulsingL in the base color there?
Any Layered template has a transparency. It uses the layer(s) beneath as it second color to mix with. In the case of a base layer, there is no layer beneath, so it doesn’t like that.
Simple fix is prepend a layer of just black for the bottom most layer:
StylePtr<Layers<Black, ColorCycle<PulsingL<White,..............
or change the PulsingL and HumpFlickerL templates to solid, non-L versions (on the Styles tab in the Style Editor).