How to toggle LEDs on/off please.

  • Q&A Forum
  • [RESOLVED] How to toggle LEDs on/off please.
0
0

Is there a way to get an LED to light when a button is first pressed, and then extinguished when the same button is pressed for a second time please? (an LED toggle)

Thank you.

RESOLVED
Marked as spam
Posted by (Q&A Forum: 4, Answers: 19)
March 1, 2019 7:59 pm
83 views

yes it’s actually simple… Steve would use variables and coding hehe, but i make 2 Presets (for example) ‘Xon’ and ‘Xoff’ by default chose which you want enabled when starting the project (lets say Off is default) then in the Xon preset make a new translator disable preset XOff, by activation of this preset Xon… the add another translator when Midi input of the button U want has an output Preset Activate By Name Xoff a third translator is needed simply with a input that is active when the preset is switched, with ofcrs the output of the Light (for example) 90 XX 7F = On / 90 XX 00 = Off, then do the oposite for the Xoff preset that enables by default a light state and on button press Activate the preset Xon

if this all doesnt make sense
check the solution i recently uploaded
for the guy that wanted a switch/turnknob toggle (there i practically did the same thing)

( at March 1, 2019 8:31 pm)
0
Private answer

Thanks 🙂 It’s a DJ Mix-101. When I push the button (top-left blue one, pictured) it sends a note on signal, when I release it, it sends a note off signal. Same signals each time I press it.

Marked as spam
Posted by (Q&A Forum: 4, Answers: 19)
March 5, 2019 3:18 pm

OK so you probably have another translator using the global variable ga and toggling it as well. Please post your project file an I will have a look.

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz

( at March 5, 2019 3:28 pm)

Ah,fair point. I’ll try to upload the project file for you to check; thanks so much for taking the time to help. Really appreciate it.

( at March 6, 2019 8:32 am)

You can also disable all translators but the target one and make sure it is working OK, then enable the others one by one until the problem comes back.

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz

( at March 6, 2019 4:01 pm)

I just looked at your file you send via email. The issue is you had MIDI Thru path set which means incoming note-off messages will alway pass through since you didn’t have a translator to suppress note-off. I added a translator to suppress note off message for that button.

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz

( at March 6, 2019 5:34 pm)

AH, I see. So BomeMTP was turning the LED on but then the MIDI device itself was turning the LED off again. Thanks for taking the time to look at the file to find and explain my error – really appreciate it. 🙂

( at March 7, 2019 8:05 am)
0
Private answer

Thank you both 🙂 I’ll be able to learn from both solutions. Really enjoying the versatility of the software and great community support and spirit. Thank you both!

Marked as spam
Posted by (Q&A Forum: 4, Answers: 19)
March 2, 2019 10:02 pm
0
Private answer

Hi, it really depends on the LED of the controller you have. Usually the velocity value indicates whether it is on (127) or off (0). Other controllers have different velocity values for different colors.

First of all if you want to control the LED state by Bome, I usually add a new preset and define the input (from controller) and output (to controller) to override the project defaults (which could be other intputs and outputs from other controllers or attached DAW’s).

Then under the preset you add a translator as the example below, The below is for a momentary button (push = note on and release = note off)

Incoming Action: Note-On MIDI CH1 Note 64 any velocity

Rules:

// This will toggle the state of the global variable ga 0 to 1 and visa versa – Note you will need

// a different global variable for each LED you are controlling

ga=ga^1

// Note off value

qq=0

// Note on value

if ga==1 then qq=127

Outgoing – Note On MIDI CH1 Note 64 and velocity qq

 

Marked as spam
Posted by (Q&A Forum: 39, Answers: 3229)
March 1, 2019 8:30 pm

😂 steve we where typing the message probably at the same time, here goed with saying i’m glad u posted yours i’m gonna study it… hope to learn from it again!

( at March 1, 2019 10:29 pm)

Yep there are multiple ways to accomplish the same objective within MT Pro. Learning from others is a good idea. Your method is good if you don’t like to write rules or are running out of global variables.

( at March 1, 2019 10:44 pm)

Not sure what I’m doing wrong but it lights up when pressed and extinguishes when released. Is that the expected behavior with the rules you scripted – or should it toggle on and off only with each down-press? Thank you.

( at March 2, 2019 10:41 pm)
Are you having problem with the script I sent you or did you duplicate that translator to handle another button. The script expects momentary input press=on release=off. The script turns it into toggle press ones on, press again off. You need to make sure the output of the translator goes back to your controller and for an additional buttons, you need different global variables. I used ga for the fisrt button. You can use gb, gc … gz. g0-g9 then ha, hb … hz h0-h9 all the way to xa-xz x0-x9. Every button in this model needs a DIFFERENT global variable. If you are still having troublr, send me our script and I will have a look. Steve Caldwell Bome Q and A Moderator and Independent Bome Consultant/Specialist bome@sniz.biz
( at March 3, 2019 1:17 am)
Thanks, just trying to set up the one button before I try duplicating it for any others. When I press the button for the first time, it lights up. when I release the button it extinguishes. When I press the button a second time it stays unlit and when I release it, it also stays extinguished. When I press a third time it light’s up and then extinguishes upon release. I think the problem may be that the button is also be passing a command upon release which may be confusing the script. I should be able to work around it somehow.
( at March 3, 2019 3:28 pm)

My guess is that your button is already sending toggle message (is not momentary). If you can use MT Pros logging feature to capture your input, I would know for sure. What is the controller you are using?

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz

( at March 4, 2019 8:53 pm)