Weird menu bug. Need some advice please!

switch (menuState){
    case 0:
      switch (state){
        case 1:
        menuState = 3;
        showMenus();
        break;
        case 2:
        menuState = 1;
        showMenus();
        break;
        case 4: //Enter
        menuState = 7;
        showMenus();
        }
        break;
     case 1:
       switch (state){
         case 1:
         menuState = 0;
         showMenus();
         break;
         case 2:
         menuState = 2;
         showMenus();
         break;
         case 4:
         menuState = 8;
         showMenus();
         break;
         }
         break;
      case 2:
        switch (state){
          case 1:
          menuState = 1;
          showMenus();
          break;
          case 2:
          menuState = 3;
          showMenus();
          break;  
          case 4:
          menuState = 2;
          showMenus();
          break;
          }
          break;
       case 3:
        switch (state){
          case 1:
          menuState = 2;
          showMenus();
          break;
          case 2:
          menuState = 0;
          showMenus();
          break;  
          case 4:
          menuState = 3;
          showMenus();
          break;  
          }
          break;
        case 7:
          switch (state){
            case 5:
            b_light_value = b_light_value + 5;
            b_output =  b_output + 12.75;
            analogWrite(b_pin, b_output);
            showMenus();
            break;
            case 6:
            b_light_value = b_light_value - 5;
            b_output =  b_output - 12.75;
            analogWrite(b_pin, b_output);
            showMenus();  
            break;
            case 4:
            menuState = 0;
            showMenus();
            break;
            }
         case 8:
          switch (state){
            case 5:
            w_light_value = w_light_value + 5;
            w_output =  w_output + 12.75;
            analogWrite(w_pin, w_output);
            showMenus();
            break;
            case 6:
            w_light_value = w_light_value - 5;
            w_output =  w_output - 12.75;
            analogWrite(w_pin, w_output);
            showMenus();  
            break;
            case 4:
            menuState = 1;
            showMenus();
            break;
            }   
  }

So heres some code from a menu system I'm working on for an aquarium light. I wasn't have any issues until I added the analogWrite for the LED's. The issue is, is that when I'm in case 7(for the blue light) when I adjust the light values with left and right, it will also adjust the white value in case 8. Before I added the write, I wasn't having this bug. Can someone maybe shed some light on why it's doing that?

No final break; in case 7:?

case 7 does not have a break at the end, so code will go into case 8

Ha thanks guys. I knew it was gonna be something silly.

:slight_smile: :slight_smile: