Forums > MaxMSP

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

March 6, 2012 | 8:29 am

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!


March 6, 2012 | 9:30 am

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. –

March 6, 2012 | 9:51 am
– Pasted Max Patch, click to expand. –

March 6, 2012 | 9:53 am

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

Attachments:
  1. GateButton.amxd

March 6, 2012 | 10:00 am

@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. –

March 6, 2012 | 1:25 pm

But the Live.button is always round, no?


March 6, 2012 | 1:50 pm

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

– Pasted Max Patch, click to expand. –


Ch
March 6, 2012 | 11:11 pm

an other one using the "idle mouse" outlet of textbutton

– Pasted Max Patch, click to expand. –

`


Viewing 8 posts - 1 through 8 (of 8 total)