Hi) I have AKAI APCmini. I need turn off some LEDs when I push some button.
For exempl: I push button 1 (start blinling) and LEDs of buttons 2,3,4 stop blinking, then when I push button 2 LEDs of buttons 1,3,4 stop blinking, then I push button 3 and LEDs of buttons 1,2,4, stop blinking, the same with button 4.
I have these rules on my LEDs (buttons)
// Toggle variable
// I assume 6 is led on and 0 is led off
if ia!=80 then pp=6
if ia==80 then pp=0
which allow me turn on LED when I press first time and turn off LED when press second time.
Here is an example and should get you close. I use the following global variables.
ia = button 1 state
ib= button 2 state
ic= button 3 state
id= button 4 state
Only the active presets are being used
When you push a button it toggles the button’s existing state (as you showed above). It also ends LED off messages to other buttons on output and turns their state off.
Note that if you are going to do this with 64 buttons (of the APC MINI. You will probably want to bitmap the global variables instead of having a separate global variable for each button. I have bitmapping examples out there just search the forum on “bitmap” or “bit map”.
With Bit Mapping you can control on/off state of 64 buttons with two global variables (32 bit signed intergers).
If you want to control more than two states, you will need more global variables. For instance for 4 states tracked you would need 4 global variable (2 bits per LED).
Independent Bome Programming Specialist
Bome Q&A moderator
Here is a project file which I worked with a few months ago for APC40 that demonstrates how to use bit mapping.
In this example we control on off state of all lights and there are also buttons to switch banks. We control 2 banks of 64 lights
The main buttons just toggle on/of state of indivual LED.s
The left lower circle turns all LED’s on, the one just to the right of that turns them all off. The round Device button at the bottom, toggles banks.
Refreshing all of the lights is done timers for efficiency. The timers iterate through all of the lights turning them to their current state depending of the bit map of the global variables controlling them.
Thanks for your suggest! I tried did something similar and it works, your way also works good. BUT I can`t fix one problem: when I push one button (start blinking), other (which I need) stop blinking, but problem is, when push again this button it doesn`t turn off (keep blinking). And I don`t know how to fix it.
I would be glad if you can help with this problem! I use my APCmini with SunLite (lighting program) and I really need this function.
Try this one. In this version, if any other led is on it turns on this led and off the rest. If the others are also off, it will toggle this led.
Comments are included
I chose global variable ie to figure out if any other button is on but it probably didn’t need to be global.