I've added a 12mm momentary switch button connected to a STEMMA JST PH 2mm 3-Pin connector with female sockets to give me some immediate control over my costume. I ended up switching to a panel-mounted rocker switch for the final build, since it's easier to feel through a few layers of clothing. But this one is easy to set up for testing, and the wiring is the same for either switch.
Find your 3-pin mini Stemma connector. Use some pliers to straighten out the legs of your button. If your connector has female sockets, you can just slip the button legs in. Connect one leg of your switch to white and one to black. It doesn't matter which leg goes to which wire, but be sure to use the legs on the same side (the ones going straight across are connected inside, so are really the same leg).
For the final build, we'll cut off the connectors and solder the switch to the project, but for the prototyping phase this simple setup will work just fine.
Open up the LED settings screen in WLED under "Config". Scroll to the button setup section and set button 1 to use pin 13, with the type set as "Pushbutton" if you're using a momentary switch. Note that there are a lot of different control methods available here as well: many of these can be connected in the same way.
Click save. Try pressing your button and see if your effects change. The default behavior for button 1 is to cycle through effects, but we can change this and set up the button for any number of behaviors using the Presets panel.
I advise against using button 0. WLED's buttons have some default behaviors written in, and one of button 0's default behaviors is that when it's pressed for more than a few seconds, it resets your microcontroller to factory settings. I originally had button 0 selected, and I held the button down a bit too long while I was sewing it onto my project, and .. POOF. All my settings and presets were wiped out.
Check out the "Backup" section under the Additional Settings page to learn to back up your configuration and presets, in case this kind of thing happens to you.
Next, head to the Time & Macros config screen. Scroll down to the Button actions area.
For button 1, enter the number assigned to the two control presets you made on the last page. My Next_FX preset is number 22, so I entered 22 under "short press", and my Toggle preset is number 21, so I've got that set up as a "long press".
I also added my playlist toggle to preset 20, so a double-click of my button will turn sound reactive mode on or off.
Troubleshooting
If your button isn't working, here are some things to try:
- Double check both the LED preferences page and the Time & Macros page to be sure your settings are correct, and have saved. Button 1 should be set up on Pin 13, as a pushbutton.
- Be sure your presets are correctly numbered. WLED gets confused if the presets have non-sequential IDs (so make sure they're numbered 1, 2, 3 rather than 2, 5, 7).
- Be sure you're connected to the correct legs on your button. You want the legs on the same side (facing the same way), rather than connecting to the two top legs or the two bottom legs. Those pins are connected together inside the button so won't work when the switch is activated.
Page last edited February 03, 2025
Text editor powered by tinymce.