Code error, Probably Simple but need help :)

I am trying to use 2 micro-switches to turn a continuous rotation servo.

Button 1 turns it CW continuously while pressed
Button 2 CC. continuously while pressed

I have this code (Below) but the problem is that it turns the rotation on constant.

How do i change this so that the servo only turns while one of the buttons is pressed and stops turning while the button is not pressed?

This must be super easy to alot of people, but my head is fried

Thank you

cc_cw_constant_spin.ino (1.29 KB)

You need a final else clause to deal with the case where neither button is pressed, which will set the servo to the stop position.

Thank you, I will try this