How to synchronize Accent LEDs?

I just installed a saber with two illuminated switches, and one is a custom-made neopixel-lit one, and the other is a standard single-color one.

I’m trying to set up a pretty simple set of bladestyles so that when the saber is off, both LEDs turn on, then there is a staggered off, and then they both come back on at the same time, etc. and when the saber is on, one has an LED lit, it goes off, and then the other LED blinks twice in the time it takes the first LED to come back on.

This is where I’m at atm (I’m struggling through the style editor… so if you have any general recommendations for tips, trick, and better things to do, please let me know)

StylePtr<Layers<Sequence<Orange,Black,50,36,0,0,111000000111>,InOutTrL<TrFade<0>,TrFade<0>,Blinking<Orange,Black,3500,500>>>>(),
StylePtr<Layers<Blinking<White,Black,1200,600>,InOutTrL<TrFade<0>,TrFade<0>,Blinking<White,Black,3750,250>>>>(),

I’m using the sequence style for the one LED since I seemed to gather that you can only have two colors in the blinking style (also, please correct my terminology if/when I’m wrong).

The two LEDs turn on at different times when booting up the saber, and then they don’t keep their timing it doesn’t seem, so the “car blinker” phenomenon is effectively what’s happening here, and I have no clue if it’s possible to fix this. I have a feeling maybe not, due to the differences in the way the two LEDs are driven, but, I figured I would ask.

My BladeConfig section:

BladeConfig blades[] = {
 { 0, WS281XBladePtr<116, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
      WS281XBladePtr<1, blade4Pin, Color8::GRB, PowerPINS<bladePowerPin4> >(),
      SimpleBladePtr<CreeXPE2WhiteTemplate<550>, NoLED, NoLED, NoLED, bladePowerPin6, -1, -1, -1>(),
CONFIGARRAY(presets) },

I recommend using Sequence for both of them, that should make them synchronized. (If the sequences have the same length.)

Your use of Sequence is a bit weird though. Normally you would want to prefix your bit sequences with 0b to make them bit sequences, and each bit sequence should be 16 bits long, like 0b0000000000000000.

Ok, thank you, I’ll try that when I get a chance, I didn’t realize that about the sequence.

Would that affect the off-state as well? Since they are both using the blinking style then (currently)?

If you want them synchronized, then yes, I recommend using a Sequence for that too.

Ok, noted, I’ll try that out now, thank you!

Btw, this is completely unrelated, and doesn’t affect functionality whatsoever, but I noticed this:

This page has been accessed times since , .
Last modified: ,

(missing the times and dates)

On the style editor page.

The HTML for the style editor has some tags in it that only works with a Roxen web server.
So it will look a little wonky if you load it directly from github or a local file.

That works brilliantly! Thank you so much. One last question I have, and this is most likely a simple mistake/oversight and a dumb question, but… anyways.

With this bladestyle:

Layers<
  Sequence<Orange,Black,50,36,0b0,0b11111001,0b1111>,
  InOutTrL<TrFade<0>,TrFade<0>,Sequence<Orange,Black,50,90,0b1111111111111111,0b1111111111111111,0b1111111111111111,0b1111111111111111,0b1000000000000000,0b0>>>

The orange blink when on seems like the first blink is much longer than the second one, and when on the saber itself it seems that there is definitely a gap before the second light comes on (which there shouldn’t be since they’re timed right next together).

Adding additional 1s seems to fix the problem, but that doesn’t make sense to me, because I set the number to 36 bits, and I count 36 bits, and five on bits should be 250ms, and both those blinky sections are five bits… but, clearly I’m missing something.

Wait… hold up

Well, the 0s got deleted from the beginning of the second sequence by the editor, would that be a problem? EDIT: Doesn’t seem like that’s being a problem, it’s something else based on the way the lights are behaving.

(There should be 24 0s for 1200ms)

Me looking it over, I don’t see anything wrong, but clearly there is.

Any ideas? (not so much for this, since I know how to “fix” it, just to understand it for the future)

Filling the last bit sequence is what makes it behave as expected, despite there not being that many bits specified, guess that’s what I’m supposed to do.

1 Like