Inverting button lit state

Greetings!
I am successfully muting and unmuting channels in the octatrack.
But strangely in the Octa a value of 0 = muted and 1-127 is unmuted.
So i’m getting the reverse function of what I would like with the button light.
When the button is unlit the track turns on and when it’s lit the track turns off.

Appreciate any help!

1 Like

Welcome to the forum!

I assume you modified some default code to get your Grid setup? It should be easy enough to invert the LED state.

Can you post the ‘Init’ tab and ‘Button’ tab that you currently have setup?

You can use the following to invert the LED state:

On the ‘Button’ tab, delete the LED code block and add a new ‘Code Block’:

Delete Button LED Block


Click on ‘Edit Code’ and add the following:

if self:button_value() == 0 then
    led_value(num, 1, 127)
elseif self:button_value() == 127 then
    led_value(num, 1, 0)
end

The above says “If the value of the button is ‘0’ then set the LED to 127 or else if the value of the button is ‘127’, set the LED to 0”.

That code worked perfectly, thank you so much!!

1 Like