Forums > MaxMSP

1 and 0 on off switch

Jan 14 2012 | 11:44 pm

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.

  1. 1and0switch.maxpat
Jan 15 2012 | 12:09 am

You can use mousestate and a gate to do it:

— Pasted Max Patch, click to expand. —
Jan 15 2012 | 1:12 am

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

Jan 15 2012 | 1:24 am

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

Jan 15 2012 | 1:27 am

That’s much better.

Jan 15 2012 | 1:30 am

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

Jan 15 2012 | 1:34 am

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.

Jan 15 2012 | 10:46 pm

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

Jan 15 2012 | 10:52 pm

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

-- Pasted Max Patch, click to expand. --

Jan 15 2012 | 11:24 pm

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

Jan 16 2012 | 1:17 am

i use [sel 1] for this..

-- Pasted Max Patch, click to expand. --

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

Forums > MaxMSP