Quick Sign In:  

Forum: VirtualDJ Technical Support

Topic: Change state of LED based on button pressed
Is there some way for me to code the LED so it will change function based on the down state of a button?

For example (The Led name is LED_BUT_HOR_1 and the button it checks for is BUT_HOR_1):
down "BUT_HOR_1" ? off : color red
^This code obviously doesn't work, but I was wondering if I'm able to change it so it actually would work.

Controller is the Novation Launchpad MK2.
The function of the specified button is "automix_skip", HOWEVER, I want to be able to use this function for all buttons on my controller (so each button that gets pressed will turn off it's respective LED)

In advance, I appreciate any help given.
 

Posted Mon 27 Nov 23 @ 5:05 pm
This is going to be more complicated than you expect, because what you want to do is not something common..
First, you'll have to modify the button itself.
The sample codes here will not suit for all cases, but they should work for most of them: automix_skip & set 'But_Hor_1_Dwn' while_pressed
Then you modify the led var 'But_Hor_1_Dwn' ? off : color 'red'
For the leds, on many cases you may have to substitute the second part of the code with part of the original code of the LED.
 

Posted Mon 27 Nov 23 @ 7:42 pm