Turning Momentary CC Pad into Latching Toggle?

Hi,

Is there a way to use BMT to translate a momentary-type CC Pad into a Latching type? Right now, the pad sends a value for while I’m pressing (127), and then one for a release (0), but essentially I want to press it once to get it to send 127, and then once more to set it back to 0. Thanks!

Hi and welcome back.

Yes please find the below project file. I have translator 0.0 set up as CC momentary to toggle. Every button will need to have it’s own global variable using this method.

The second translator is Note Momentary to toggle in case you are interested.

I use the global variable ga for the first translator and gb for the second.

Here are the rules for the first.

// Toogle the value of ga
ga=ga^1
// setup outgong variable
qq=0
if ga!=0 then qq=127

and the project file.

Momentary-to-Toggle-Demo-2024-01-28.bmtp (1.6 KB)

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Thanks, Steve, this is a great start. I’m trying to figure out how to have it send out a different CC Data2 value depending on whichever alternation it is on. So let’s say I want CC#111 to send out value 1 on the first press, and when I ‘unpress it’(pressing it again), it sends out value 2. Would I have qq=1 and qq=0 in this case?

Hi, I simply change these rules:

// Toogle the value of ga
ga=ga^1
// setup outgoing variable
qq=0
if ga!=0 then qq=127

to this:

// Toogle the value of ga
ga=ga^1
// setup outgoing variable
qq=1
if ga!=0 then qq=2

Then set the outgoing CC# to 111:

image

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Ok, I changed them to match your code. When I press the pad, in the log window it outputs CC#111 with value 02 (qq). When I press it again, it should output CC#111 with value 01, right? For me it’s only outputting 02. Do I need a second translator for the second ‘toggle’ press? And should the incoming message be set to value 127, variable to ga?

Check your code changes again. It should work.

The 3rd byte is different values on the incoming, and the output is always BF 6F 00 on release. The revised rules match with yours.
Capture

See the attached:

Momentary-to-Toggle-Demo-2024-01-28.bmtp (1.6 KB)

Here is a copy of the log window.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz
1 Like

Ohhh, I got it now. My incoming message had to be set to value 0 for it to function, otherwise it still behaved as a press/release event. Checked the log window and my device, looks like everything’s working as it should now. Thanks for sticking with me!

I guess I have one follow up: is there a way I could adjust the code so that it works with a PC pad?

Just change the incoming trigger to the PC change message you are sending.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz
1 Like

Thanks :slight_smile: