Initiate toggle on/off with XBOX 360 Controller?

jl8080's icon

I have hooked up my XBOX 360 controller through MAX using the HI object, all is well and good. But I want to toggle between on and off by pressing the same button, lets call this button 'Y'.

Example: The toggle is set to off. I push button Y once and the toggle is on and stays on until I press button Y again and the toggle goes to and stays off.

Been trying for ages now and I can't suss it out!

Please help,
James. ;)

vze1mk7d's icon

I don't know the numbers the xbox controller sends to max, but you can use a select object connected to a toggle to do what you want. An example is this using the computer keyboard "y".

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

Steven Miller's icon

Assuming your button only sends a control message when it is pushed
OR released (not both) you can simply route it through [trigger b]
into the toggle. One of the functions of toggle is to change state
with each incoming bang.

If your button sends control messages on BOTH push and release,
you'll need a way to differentiate between them or remove one of
them, and then apply the procedure above. If they send the SAME
message for push and release you could first send them to a counter
set to count from 0 to 3 and use the count output to [> 1] to the
toggle.

On Mar 19, 2008, at 1:02 PM, James wrote:
>
> I have hooked up my XBOX 360 controller through MAX using the HI
> object, all is well and good. But I want to toggle between on and
> off by pressing the same button, lets call this button 'Y'.
>
> Example: The toggle is set to off. I push button Y once and the
> toggle is on [b]and stays on[/b] until I press button Y again and
> the toggle goes to [b]and stays off[/b].
>
> Been trying for ages now and I can't suss it out!

----
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe

Home
SFIFEM
Atrium Sound Space
OVOS
CMP

jl8080's icon

It's:

hi: 54 128 (when the button is pushed down)

and,

hi: 54 0 (when the button is released)

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

jl8080's icon

Thats fantastic thanks for your help.

I was just trying to use Sel on its own, didn't realise you needed a number box between the 'route' object and the 'Sel'. Total noob with this stuff - doing it for a uni project.

Cheers,
James.