You don't have a delay in the fade loop, this goes from 0 to 255 almost instantly:
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(ledg, fadeValue);
}
But I'm not sure you want to fade from off to on in one go. If you want to just increment and decrement the brightness:
First notice that prevR, prevG, prevB
hold the current led values. So we shall use them.
Change the switch case to:
case BRIGHTNESS_UP:
modus = 0;
int c[3];
// decrease by 0.9*value but also take off 2 so we get to zero
c[0] = (prevR-2) * 90 / 100;
c[1] = (prevG-2) * 90 / 100;
c[2] = (prevB-2) * 90 / 100;
for( int j = 0; j < 3; j++ ) {
if (c[j] < 0) c[j] = 0;
}
crossFade(c);
break;
case BRIGHTNESS_DOWN:
modus = 0;
int c[3];
// increase value by 1/0.9 but also add 2 so we get off zero
c[0] = (prevR+2) * 100 / 90 + 2;
c[1] = (prevG+2) * 100 / 90 + 2;
c[2] = (prevB+2) * 100 / 90 + 2;
for( int j = 0; j < 3; j++ ) {
if (c[j] > 100) c[j] = 100;
}
crossFade(c);
break;
I can't check this to see if it works see please test and see.