How to turn on a led for the time that a button is pressed down?

Mar 6, 2012 at 8:29am

How to turn on a led for the time that a button is pressed down?

Hello,

I have a question about buttons. Is it possible to create a button that sends ’1′ for the time that you click on it with your mouse, and sends ’0′ when you release your mouse button? I want to turn on a led for the whole time that a button is pressed down.

Now I’ve done this with a toggle, but it doesn’t give exactly the right effect. Since you need to click twice to turn it on and off.

Thanks a lot!

#62183
Mar 6, 2012 at 9:30am

There’s probably (got to be!) something simpler, and the toggle engages with mouse clicking elsewhere on the window, but it does work..

– Pasted Max Patch, click to expand. –
#224597
Mar 6, 2012 at 9:51am
– Pasted Max Patch, click to expand. –
#224598
Mar 6, 2012 at 9:53am

I had the same problem and made my own using the ubutton and an Int.

Attachments:
  1. GateButton.amxd
#224599
Mar 6, 2012 at 10:00am

@soma:

in M4L you can set bang transition of Button to both sides, 0 to 1 and 1 to 0

– Pasted Max Patch, click to expand. –
#224600
Mar 6, 2012 at 1:25pm

But the Live.button is always round, no?

#224601
Mar 6, 2012 at 1:50pm

yes, but you can overlay a panel if roundness is a issue.

– Pasted Max Patch, click to expand. –
#224602
Mar 6, 2012 at 11:11pm

an other one using the “idle mouse” outlet of textbutton

– Pasted Max Patch, click to expand. –

`

#224603

You must be logged in to reply to this topic.