1 and 0 on off switch

m1ndbullet's icon

using a toggle box which when a pressed inputs a 1 and released inputs a 0, is there any way to press it and release and have the one held in, its easier to see in the patch,

any help would be hugely appreciated.

3212.1and0switch.maxpat
Max Patch
Rodrigo's icon

You can use mousestate and a gate to do it:

Max Patch
Copy patch and select New From Clipboard in Max.

Luke Hall's icon

Or just use [pictctrl] and create yourself an image of the [toggle] on and off states stitched together!

m1ndbullet's icon

hey guys thanks for all the help, its actually using an xbox controller, for example pressing the green A button creates a 1 and then a 0 when releasing it

Rodrigo's icon

That's much better.

m1ndbullet's icon

but i cant get the toggle to stay "on" when pressing and realeasing it untill i press it again and it goes "off"

Rodrigo's icon

Not sure I follow you now, do you want it to be momentary (press=on, release=off) or latching (press=on, press again=off).

If you're using a control that sends a 1 and a 0 then you're done already, when pressing the button, its a 1, and when you let it go it's a zero, you don't even need a toggle (if I understand you correctly). That's how it is with the wiimote.

m1ndbullet's icon

it would be a latching system, at the moment when i press and hold the button the step sequencer starts but it stops when i release it.

Thanks for all the support so far guys

Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.

[Togedge] is your friend here, if I'm understanding you correctly:

m1ndbullet's icon

yessss sir! :D thanks soooo much! :D :D ^^

AudioLemon's icon
Max Patch
Copy patch and select New From Clipboard in Max.

i use [sel 1] for this..