How to use Macro to call preset 1 when the button is pressed and call preset 2 when the button is up

How to use Macro to call preset 1 when the button is pressed and call preset 2 when the button is up

Configure the button as a Switch under LED Preferences.
Then you can choose a presets to apply for On->Off (pressed) and Off->On (released).

Very nice, it worked, but it didn’t meet the needs.
It needs to detect that when the physical button is pressed, preset 2 will be played for three seconds or played three times, and then preset 1 will be played automatically.

There is no need to detect that the button is popped up, because I used the way of throwing an airplane to pass through the light ring to make preset changes. The switch only takes 0.1 seconds, and I can’t respond.

I used the NeoPixelBus library of esp32 to achieve this video effect. It is very troublesome to change different special effects. The ability to write special effects is limited, so I want to try WLED.

I suspect you’re into Usermod territory here.
You might look at the Staircase mod implentation(s).
They are designed to trigger strips under various cases of PIR sensors being tripped.

Don’t know how much success you’ll have as 100ms (or less) is getting rather tight for timing.
Many of the playlist specs and effects changes need that much time to trigger.

Maybe it’s a Chinese translation problem, you didn’t understand what I meant.
I only need to detect the open state, play preset 2, and automatically play preset 1 after the animation is played, no need to detect 100 milliseconds

use a playlist

1 Like

It worked, thank you very much. New question, the special effect speed is adjusted to the fastest, but it is not fast enough, which parameter to change?

You’re right, the paper airplane goes by too fast, it won’t be detected.
Isn’t wled interrupted to detect? Or is it caused by a delay in detection?

I don’t know all the final details on the internal code, but I believe the priorities are to maintain the smoothness of the effects rather than the trigger of an external event interrupt (could be wrong).

Is your intent to do an effect on each ring as the plane passes or on some kind of status board?

In general, I find WLED is very good at maintaining it’s own effect “environment” and syncing with other WLED devices. When it gets to syncing with the rest of the world and outside influences, the best control comes when you create an LED “stream” from another source (LEDFX for eg.) and have WLED display that in realtime. I suspect you’ll end up there with your tight time requirements.

Just my $.02

The plan is that the plane passes through each small ring to generate upward converging meteor special effects, triggers the outer large ring after completion, and sends an event to the PC computer on the large LED screen in front to prompt the scoring situation.

So far the effect is not satisfactory