Help programming accent LEDs

It’s been a year since the last post, but the topic seems to be the right one. I recently did an install on my two ROTJ sabers (I had originally built the two hilts for static display)

My ROTJ Vader setup is fine, but on my Eco Hero Luke hilt, I’d like the red/green arrows to blink or something.

I understand that the two LEDs are each additional “blades” but haven’t been able to nail down a way to get them to DO anything. I tried the style above, but the LEDs just come on when the blade extends and turn off after the blade retracts.

What am I missing here? I’d appreciate any help. I was able to get the code working for a full-sized, multi-processor BB-8, but these 2 LEDs are making me crazy! :slight_smile:

I split this post out to a new thread.

In general, the recommendation is to start a new thread if you’re looking for help and add to existing threads when you’re providing help.

Do you have a config file that compiles but doesn’t do anything? If so, why don’t you post that so we can take a look?

Thank you. I wasn’t sure if I should start a new thread since the topic was exactly what I was looking for (and I was talking about config info from the earlier thread)

Here’s the original Eco Hero config that I got from Kal. Not entirely sure the preferred method of posting it on this forum it, so I’ll just paste it in below. There LEDs come on with power-up and stay on for a while after blade retraction. The code from the earlier thread has them turn on when the blade is activated and turn off after the blade retracts (preferred behavior) but in both cases they just stay on.

Thanks!

#ifdef CONFIG_TOP
#include "proffieboard_v2_config.h"
#define NUM_BLADES 3
#define NUM_BUTTONS 2
#define VOLUME 2000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 2.5
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#define SAVE_COLOR_CHANGE
#define SAVE_STATE
#define SAVE_VOLUME
#define SAVE_PRESET
#define ENABLE_SSD1306
#define ENABLE_SERIAL
#define DISABLE_DIAGNOSTIC_COMMANDS
#define IDLE_OFF_TIME 60 * 1 * 1000
#endif

#ifdef CONFIG_PROP
#include "../props/saber_sa22c_buttons.h"
#endif

// ECO Hero

#ifdef CONFIG_PRESETS
Preset presets[] = {

////////

{ "TheRtrn", "tracks/FnlDuel.wav",
StylePtr<Layers<AudioFlicker<RotateColorsX<Variation,Green>,RotateColorsX<Variation,Rgb<0,128,0>>>,TransitionEffectL<TrConcat<TrInstant,BrownNoiseFlickerL<AlphaL<White,Int<16000>>,Int<50>>,TrSmoothFade<600>>,EFFECT_LOCKUP_END>,ResponsiveLockupL<Strobe<White,BrownNoiseFlicker<White,Red,300>,50,1>,TrConcat<TrInstant,White,TrFade<400>>,TrFade<100>,Scale<BladeAngle<0,16000>,Int<10000>,Int<30000>>,Int<10000>,Scale<SwingSpeed<100>,Int<10000>,Int<14000>>>,ResponsiveLightningBlockL<Strobe<White,AudioFlicker<White,Blue>,50,1>,TrConcat<TrInstant,AlphaL<White,Bump<Int<12000>,Int<18000>>>,TrFade<200>>,TrConcat<TrInstant,HumpFlickerL<AlphaL<White,Int<16000>>,30>,TrSmoothFade<600>>>,ResponsiveStabL<Red,TrWipeIn<600>,TrWipe<600>>,ResponsiveBlastL<White,Int<400>,Scale<SwingSpeed<200>,Int<100>,Int<400>>,Int<400>>,ResponsiveClashL<White,TrInstant,TrFade<400>,Scale<BladeAngle<0,16000>,Int<10000>,Int<30000>>,Int<10000>>,LockupTrL<AlphaL<BrownNoiseFlickerL<White,Int<300>>,SmoothStep<Int<30000>,Int<5000>>>,TrWipeIn<400>,TrFade<300>,SaberBase::LOCKUP_DRAG>,LockupTrL<AlphaL<Mix<TwistAngle<>,Red,Orange>,SmoothStep<Int<28000>,Int<5000>>>,TrWipeIn<600>,TrFade<300>,SaberBase::LOCKUP_MELT>,InOutTrL<TrWipeX<Scale<BladeAngle<>,Int<500>,Int<200>>>,TrWipeInX<Scale<BladeAngle<>,Int<800>,Int<300>>>,Black>>>(),

StylePtr<InOutHelper<White, 1, 1, Sequence<White, Black, 200, 30, 0b1010101010101010,0b1000000000000000>>>(),

StylePtr<InOutHelper<Blinking<Black,White,1500,500>, 1, 1, Sequence<White, Black, 200, 30, 0b0000000000000000,0b0010101010101000>>>(),"the\nreturn"},

////////

{ "Battery", "tracks/.wav",
&style_charging,

StylePtr<InOutHelper<White, 1, 1, Sequence<White, Black, 200, 30, 0b1010101010101010,0b1000000000000000>>>(),

StylePtr<InOutHelper<Blinking<Black,White,1500,500>, 1, 1, Sequence<White, Black, 200, 30, 0b0000000000000000,0b0010101010101000>>>(),"Battery\nLevel"},

////////

};
BladeConfig blades[] = {
 { 0, WS281XBladePtr<132, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
    WS281XBladePtr<1, blade2Pin, Color8::GRB, PowerPINS<bladePowerPin4, bladePowerPin5> >(),
    WS281XBladePtr<1, blade4Pin, Color8::GRB, PowerPINS<bladePowerPin6> >()
  , CONFIGARRAY(presets) },
};
#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
Button AuxButton(BUTTON_AUX, auxPin, "aux");
#endif

The 2nd and 3rd blade styles in each preset drive your accent LEDs.
They are programmed to do blinking.
If your LEDs are not blinking…

Is it 60 seconds after blade retraction?
If yes, that would coincide with IDLE_OFF_TIME 60 * 1 * 1000, and to me sounds like you have regular LEDs, not addressable pixel LEDs, and therefore are not driven by data. This means the blade style programming would be useless, and the power to the LED pads is the only thing driving them.
I am just answering quickly here without much thought and might be wrong (would they even light if using WS281XBladePtr?)

Also you have a small accent on both LED4 and LED5?

I would say you could try assigning them as normal LEDs instead with blade definitions, something like:

BladeConfig blades[] = {
 { 0, WS281XBladePtr<132, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
    SimpleBladePtr<CH1LED, NoLED, NoLED, NoLED, bladePowerPin5, -1, -1, -1>(),
    SimpleBladePtr<CH1LED, NoLED, NoLED, NoLED, bladePowerPin6, -1, -1, -1>(),
    CONFIGARRAY(presets) },

The Goth Eco Hero chassis comes with the switches, LEDs and resistors pre-installed on a small board. The LEDs only have power and a switched ground (on pins 4 & 5).

(The shutoff delay is about 60 sec, that makes sense.)

I tried your suggested change (changing the BladePowerPins to 4 & 5) and now One LED flashes on-on-on-off - but the second was solid on.

THAT’S when the lightbulb :bulb: went off… I went up to the style, switched a few of the ones for zeros, and now they’re both blinking happily away.

Now, another quick question about the style sequence:

“StylePtr<InOutHelper<Lockup<Sequence<White, Black, 200, 16, 0b1100110011000000>, AudioFlicker<White, Black>>, 1, 500>>(),”

More specifically “White, Black, 200, 16, 0b1100110011000000>”. I’m guessing white is on, black is off, and I’ve determined that the string of ones and zeroes show the pattern of the blinking.

Are the 200 and 16 durations of a sort? Would that control the rate of the blinking?

In any case, thanks for the suggestion! It worked! And I learned a lot… (although I obviously have a lot MORE to learn…)

Thanks again!

No need for an answer - I went in and did a little playing and confirmed my theory about those values. Got 'em blinking really nice.

Before today I would’ve been afraid to screw something ELSE up by making any changes I didn’t know about, but knowing I have support from you all, I’m more confident.

Thanks again!

200 is the milliseconds per bit. 16 is how many bits.

https://tinyurl.com/59zfzu7v

Or just read the documentation:

Fwiw the answer is yes. They’d just be on.

Thank you. I tried looking at some of the documentation, but without an idea what I was even looking for, it was hard to find anything relevant. But the one link you provided me provided me with insight on how to better find what I’m looking for from now on.