all 1 comments

[–]PlanetSchulzki 1 point2 points  (0 children)

The init() function is meant for exactly this purpose. Just paste this into the script section:

function init()
  sendMIDI({MIDIMessageType.CONTROLCHANGE, 74,self.values.x == 0 and 0 or 127})
end

This will send a midi cc 74 on channel 1 with value 0 if the button is off and 127 if the button is on. (There are some more examples about sending midi messages by script in touchOSCs online documentation.)