Best practice for illuminating AV switch

So I just wrapped up my first Proffie install, but I just have one more thing to fix: applying Blade Styles to my button. I’m using a 12mm Illuminated momentary switch with a blue LED rated at 3v, 20mA and I threw a 220ohm resistor on it for good measure.

I currently have it installed between 3.3v and LED1, but it appears to be staying on as long as the battery is inserted. It could be because I haven’t applied added LED1 as a blade, but that is where I’m stuck.

Would anyone happen to have a code snippet that they’ve used on an AV switch like mine? Here is my current Pixel blade config:

BladeConfig blades[] = {
 { 0, WS281XBladePtr<132, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(), CONFIGARRAY(presets) },

Any help would be appreciated.

You’ll want something like this:
You will also need to increase NUM_BLADES to 2, and for every preset you’ll need two styles instead of one. The second one will be for the button. The button will only light up when the second style provides a white color.

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

If you want the button to light up when the saber is on, you would use something like:

    StyleNormalPtr<WHITE, WHITE, 300, 800>(), 

for the second style.

Also, 220 is quite a bit more than you need.
If you hooked it up to batt+, a 60 ohm resistor would be enough.
When you hook it up to 3.3v, a 15 ohm resistor would be enough.

Although hooking LEDs up to 3.3v can introduce noise that can cause problems for the board in some cases, so it might be better not to do that.

1 Like

Thanks, I’ve updated my code and was able to flash successfully.
Is there anything I can do to turn the led off? It still appears to be on indefinitely even while not ignited, unless it will now be affected by the IDLE_OFF_TIME, which I haven’t gotten to yet.

I’ll also move the 3.3v line to Batt+ once I crack her open at a later date. Is there anything I should look out for in terms of wonkiness from the 3.3v pin in the mean time?

If it dosen’t turn off, then something is wrong somewhere. Either with your wiring, or with the configuration.

Have you bridged the switch neg with the LED neg at the switch? Some people want their switch LED to be permanently on as an indicator of battery power. In which case, you can successfully bridge the switch neg with the LED neg and take the LED neg to a board neg (rather than an LED power pad).

However in your case, all four terminals on the switch need to be separate as follows:

Switch 1 - Proffie switch pad
Switch 2 - Proffie Ground
Switch LED Positive - 3.3 volt pad (or battery +, but I use 3.3 volt)
Switch LED Negative - LED power pad, and added to config as a blade

Hope that helps.

1 Like

Thank you both! I cracked it open, resoldered and heat-shrunk a few sketchy points on the switch. I noticed that my negative wire for the switch button was wired into battery negative, instead of ground, so I made that switch. In between doing those it turns out to work now! Switch goes off when the blade is off, and goes on when ignited.

This means it’s totally possible for me to create reactive blade styles for the button right? Audioflicker, pulse, etc, etc, as long as I program the color to white?

Thanks again!

That is correct.

1 Like

When flashing a configuration like so:

  { "SupremeLeader", "SupremeLeader/track.wav", StylePtr<Layers<
  InOutTrL<TrWipe<300>,TrWipeIn<500>>>>(), StylePtr<AudioFlicker<White,Black>>()},

my LED stays on constantly (while not in idle). Would I need a sort-of IN-OUT transition to ‘unignite’ the LED as well?

Correct. You can also make the “color when off” argument of that InOutTrL be a pulse, or something other than Black.

1 Like

Thanks, that’s a really cool idea! Before I change my config, will I be needing an InOutTrL:


Or an InOutTr?:

I’m not sure I understand the differences too well. Maybe I need to take a Proffie bladestyle course.

Layers are good when you need multiple…layers. InOutTrL the L stands for Layer.
If you were to use that, it would need to be inside a Layers<>.
On it’s own as the only part of the style, InOutTr (just the transition with the base color built in basically) works fine.
The InOutTr you have, if broken out into layers would be

1 Like (2)

Excellent, my journey is almost complete. Is there a method to apply this same blade style to all of my presets, without just pasting the same line in each one?

It’s easiest to just paste the 2nd style into each preset.
Otherwise, yes, there could be editing of presets.ini / save files / Edit Mode / WebUSB Workbench page involvement if you want.

1 Like