Page 1 of 1

Different function for each button press

Posted: 11 Dec 2012 15:16
by benwin
Hello, first post, I know this is a simple question, I have tried searching but it is too broad a question to easily search for.

I need a basic setup to trigger then release lighting cues via OSC.

How do i configure a button to send one OSC command when "turned on" and another OSC command when i "turn off" the same button.
I have tried using both a custom button and a switch, I can see how to choose when the message is sent, leaves 0, gets to 0 etc. but how do you produce different functions for each?

Thanks for your help

Ben

Re: Different function for each button press

Posted: 11 Dec 2012 15:39
by Softcore
One way would be to create scripts for the push and release of the button....

For example

Code: Select all

script on Expression x

If (x=0) oscout(target, adress, args[]);
else if (x=1) oscout(target, adress2, args2[]);
Actually I think it would help if you specificly wrote what commands you want to send out so that the best and simplest script-solution can be given - because it all depends on what exactly you want to send out! ;)

Re: Different function for each button press

Posted: 11 Dec 2012 17:00
by benwin
Softcore, thanks for replying so quick

the command I am trying to send on the push would be "go/0/1" and on the release would be "release/0/1"

If I use a normal switch would it then mean that on the off position would it constantly send the "release/0/1" command

Thanks

Ben

Re: Different function for each button press

Posted: 12 Dec 2012 11:25
by Softcore
The difference between pads and switches is what I call (influenced by my knowledge in electrics) the difference between a switch and a push button.

Switch: it has an "on' and "off" position - in MIDI controller terms: it sends a "on" value when pressed (usually 127) and a "off" value when pressed again (usually 0)

push button: it doesnt have an alternate position, you just press it and after release it returns to initial position - in MIDI terms: it sends a "on" value when pressed (usually 127), it sends a "off" value when released (usually 0).

You can also think of it like this: your car's breaks are "pads" (push buttons) - your car's handbrake is "switch". ;)


Thats to clarify what a switch vs what a pad would do.

As to your initial question....I think this would work!
OscExample.jzml
(1.38 KiB) Downloaded 101 times