I have two LED strips that I want to fade inversely. So as one LED gets brighter, the other gets dimmer and vice versa.
I can't figure out how to do this, I'm having issues getting it to work, at first I tried:

``````brightness2 = (1/brightness1)*150 //150 being the maximum brightness
``````

But that didn't work, I ran random numbers through a calculator and realized that it wouldn't.
So what would be the proper equation to get this to work? I want brightness2 to equal 1 when brightness1 equals 150 and vice versa and every number in between (having them meet at 75)

Couldn’t you just use:

``````brightness2 = 150 - brightness1 //150 being the maximum brightness
``````

here ya go, simple short bit of code to fade both up and down with an inverse relation to eachother

``````int max = 150;
for (int i = 1; i < max; i++)
{
brightness1 = i;
brightness2 = 150 - i;
}
for (int q = max; q=1; q--)
{
brightness1 = q;
brightness2 = 150 - q;
}
``````

Thanks, big ol’ brain fart there. I’ll try that out tonight when I get home.