I'm sending letters and a number, for example, if I send M5 is music, if I send M1 ... M4 are other modes, if I send Bx the brightness is set to x.
The thing is that I used an existing project that controls M1 to M4 modes, using classes and functions with classes, and I wanted to add a music reactive project, so I mixed them.
When I change in the code the value of the "music" variable to true or false, all the modes work correctly. But when I try to change it at the loop, at else section, it doesn't enter the loop, or look like that.
I changed the code based on @drmpf solution, but I still have the same problem.
Edit. I can share the code if you want, but maybe is a bit messy.