One button dimming up and down

Hello all, a noob question,
Is it possible to make (json, API or Macro) an one button dimmer?
like: dim while pushing button down, from 0–> 255 and reverse when 255 or 0 is reached.

Thanks in advance.
Cees

image

Thanks for helping me, but actually I had already something like this, (&A=~5 and &A=~-5)
Mabey mine question was not to good,
I want 1 button do te following: On holding down brightness up to max and when max is reached, dim down to 0 and visa versa like a loop, on button release, stop dimming.

Gtr; Cees

Yeah the Bri-up example will cycle that with 40 steps and once it reaches max it will go back to min , how to use that with a button is your call .

Thanks again, I gonna experiment some things.

I found another solution, even better for my goal. I’ll used a potentiometer and works perfect.

Analog button to control brightness? - Hardware - WLED

Yeah i think that is better , lots of flexible ways to control wled if you are not restricted to buttons , rotary-encoder and display user mod is my favorite and also IR .

“The default (built-in) actions for button 0 are short-press: toggle on/off and long-press: select random color. Long-pressing for more than 6 seconds will open the WLED-AP with the default password (wled1234 ).
For further buttons, the default action for short press is cycling effects, long press ramp brightness, and double press cycle palettes.”"

Thanks for the response, the last part I tried but nothing happens.
The actions are 0-0-0 in settings. Anyway I’m happy with the potentiometer and gonna use that.

Greets, Cees