Switch...case not breaking out from second case into third case

.

The first thing that I notice is that you are reading from Serial without know if there is anything to read. You read from Serial into the cmd1 variable then never use its value. Then you do the switch based on the next available character. Why not do the switch using the value of cmd1 ?

Why do you have the while(1) loops in your cases ? Let loop() do what it does best and do the loops

If there is Serial data available then read it into cmd1 and do the switch on that value. If there is no Serial data available then the value of cmd1 will not change and the same case code will be executed the next time through loop(). Make sure that the Line Ending is set to No line ending in the Serial monitor to avoid the CR or LF characters being available instead of your command characters

.

Take the switch/case out of the if (Serial.available()) code block

Will your very helpful advice fix my inability to control the rotation direction via the serial monitor once in a function called by a case?

It should do because reading the input is not dependant on the switch/case so input will be read and the value of cmd changed regardless of the current state

.

Please post your complete program as it is now.

As a matter of interest, what have you got Line Ending set to in the Serial monitor ?

.

 if (directionReceived == 'b'  & motorDirection == 0)

& is a bitwise and
&& is a boolean and

You need a boolean and in that and other statements

NOTE : the OP updated the code that I commented on

I know that it is a pain, but please post the complete program as it is now

I have simply updated the post above where I posted it last

jgc44:
I have simply updated the post above where I posted it last

That is naughty because it makes nonsense of my comment about the use of boolean and

Please describe in full what the program is supposed to do