Servo Loops till move is complete?

I have been doing a bunch of testing to try to figure out why the program gets stuck if the
servo is not allowed to get to its programmed position.

I have 6 buttons controlling one servo and each one does something a little different.
2 of the Button that are mechanical button
and 4 Buttons (A<B<C<D)of them are digital button from a rf transmiter.

Button B has a timer set to it so that the servo will move to position and wait till the timer times out.
once the timer times out the servo moves back to center position toggle= 0 servo .Write (65)
No matter if the servo is stuck or not once timed out will go back to Center location Servo.write(65). If the servo is not stuck and does get to its commanded location I can push
button D and by pass the timer and move the servo to position 65. But if the servo does not
get to comaned location D button will not bypass the counter and move the servo back to
position (65).

I put a serial print in the If (toggle == 0) myservo.write (65) statement and the "not"
continues to print untill the timer times out even if the other buttons are pushed

Both B and D buttons are digital input buttons.
The mechanical buttons will interupt the timer but the Digital buttons will not if the servo
is not allowed to get to position.

My thought is the digital inputs are not true inputs there for do not work the same as the
Mechanical inputs. That is also why I have them setting a variables (toggle) to set a position on the servo. This helped to make the program work in the begining

Any thoughts on how to get around the Servo out of position to be interuped with the digital inputs.

Seems the myservo.write does some sort of loop that keeps the program form continuing when it is not in position.

Ron

/* Garage door opener

modified 2 march 2018
by Ron Needham

*/

#include <Servo.h>

Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int toggle = 0;
int lock = 0;
int latch = 0 ;

int Buttons =0; //Buttons in control

unsigned long Reset = 5000 ; // 20000= 20 sec timmer for rest to off
unsigned long lowreset = 200 ;
unsigned long timmer = 0;
unsigned long CurrentMillis = millis();
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
Serial.begin(9600);
// initialize the pushbutton pin as an input:
}

void loop()
{

CurrentMillis = millis();

if ((millis() - Reset )> timmer && lock == 1 ) // and or statment
{ toggle = 3;} // Sets the servo back to center after time out Door up

if ((millis() - Reset )> timmer && latch == 1)
{ toggle = 3; } // toogle 3 sets swithc back to off on the door

if (digitalRead (2)== HIGH && lock == 1){ // Door OPEN
Serial.println("ButtonA");
Reset=12000;
toggle = 1;
timmer = millis();
}
if (digitalRead (3)== HIGH){ // Door Close
Serial.println("ButtonB");

toggle = 0;
lock = 0 ;
timmer = millis();
latch = 1;
Reset = 10000;
}
if (digitalRead (4)== HIGH){
Serial.println("Button D"); //
toggle = 3;
lock = 0;
Reset = 0;
timmer = millis();

}
if (digitalRead (5)== HIGH){
Serial.println("Button C");
lock = 1;
}

if (toggle ==1 )
{ myservo.write(160);}
if (toggle == 0)
{myservo.write(65);
Serial.print("not"); // Keeps prinitng not until timmer is complete

}
if (toggle == 3)
{myservo.write(110);} // Move to switch off possition

if (digitalRead (11)== HIGH ) // Button switches
{ toggle=1;
Buttons = 1;
timmer = millis();}

if ((millis() - lowreset )> timmer && Buttons == 1 )
{ toggle = 3;
Buttons =0; } // Sets the servo back to center after time out Door up

if (digitalRead (12)== HIGH ) // Button switches
{ toggle=0;
Buttons = 1;
timmer = millis();}

if ((millis() - lowreset )> timmer && Buttons == 1 ) // and or statment
{ toggle = 3;
Buttons =0; } // Sets the servo back to center after time out Door up

I can't even begin to follow your code, for several reasons. The main one is that NOTHING follows a { on the same line.

Put EVERY { on a line BY ITSELF.
Put EVERY } on a line BY ITSELF.
Use Tools + Auto Format.

Second, the variable names don't make a lot of sense. toggle? latch? Buttons? What do these mean? Obviously, they mean something to you, but not to me.

What is the point in assigning a value to CurrentMillis, when you never use CurrentMillis?

timmer? What the heck is a timmer?

Both B and D buttons are digital input buttons.
The mechanical buttons will interupt the timer but the Digital buttons will not if the servo
is not allowed to get to position.

I was expecting to see the servo moved to position in a series of steps that could not be interrupted but all I see are straightforward myservo.write()s that command the servo to move into position. What type of servo are you using and what do you mean by some buttons being "digital input buttons". They seem to be inputs from an external device so how are they wired and do they share a common GND connection. How is the servo powered ?

In your post you mention buttons by letter but the code does not use those letters as pin names which makes interpreting the code difficult. Why not give the inputs names related to their function ?

Thanks for the support and help
I hope it is easier to follow now.

But the answer to the problem was to wire the servo to separate power supply using power from the arduino board was not enough , is my guess. Once i wired the servo to its own supply seemed
to fix my problem Any way it is working now.

Thank

Ron

/* Garage door opener

modified 2 march 2018
by Ron Needham

*/

#include <Servo.h>

Servo myservo; // create servo object to control a servo
int toggle = 3; // Toggle this to set the servo to a position 1 = door open 2=door close 3= switch off
int lock = 0; // sets a variable to identify a setting in the program
int latch = 0 ;// sets a variable to identify a setting in the program

int Buttons = 0; //Buttons in control

unsigned long Reset = 5000 ; // 20000= 20 sec timmer for rest to off 50 seconds door is fully open
unsigned long lowreset = 200 ; // reset time after mecanhiacl button is pushed
unsigned long timer = 0; // variable for millis
// unsigned long CurrentMillis = millis();
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
Serial.begin(9600); // enable serial port for debugging not need in the program
}

void loop()
{

// CurrentMillis = millis();

if ((millis() - Reset ) > timer && lock == 1 ) // After timed out switch returns to off
{
toggle = 3; // Sets the servo back to center after time out Door up
}
if ((millis() - Reset ) > timer && latch == 1)
{
toggle = 3; // toogle 3 sets swithc back to off on the door
}

// RF buttons A,B,D,C

if (digitalRead (2) == HIGH && lock == 1) //Button C lock==1 is pushed befor A to open door
{ // Door OPEN
Serial.println("ButtonA"); // RF button switch
Reset = 45000;
toggle = 1;
timer = millis();
}

if (digitalRead (3) == HIGH)
{ // Door Close
Serial.println("ButtonB"); // RF Button switch Door down or Closed
toggle = 0;
lock = 0 ;
timer = millis();
latch = 1;
Reset = 23000;
}
if (digitalRead (4) == HIGH)
{
Serial.println("Button D"); //RF Button switch Turns switch to off if needed
toggle = 3;
lock = 0;
Reset = 0;
timer = millis();
}

if (digitalRead (5) == HIGH)
{
Serial.println("Button C"); //RF Button switch Used befor A to open door
lock = 1; // safty switch both c then a to open door
}

if (toggle == 1 )
{
myservo.write(160); // Door OPen
}

if (toggle == 0)
{
myservo.write(65); // Door Close
Serial.print("not"); // Test not needed Keeps prinitng not until timmer is complete
}

if (toggle == 3)
{
myservo.write(110); // Door swithc off
} // Move to switch off possition

if (digitalRead (11) == HIGH ) // Button switches
{
toggle = 1; // Door open hold to open
Buttons = 1;
timer = millis();
}

if ((millis() - lowreset ) > timer && Buttons == 1 ) // once button is release the toggle is set back ot the off position
{
toggle = 3;
Buttons = 0;
} // Sets the servo back to center after time out Door up

if (digitalRead (12) == HIGH ) // Button switches
{
toggle = 0;
Buttons = 1;
timer = millis();
}

if ((millis() - lowreset ) > timer && Buttons == 1 ) // once button is release the toggle is set back ot the off position
{
toggle = 3;
Buttons = 0;
} // Sets the servo back to center after time out Door up

Use 
[code] tags.
switch() { case: } structures
Consider array[]s to normalise your code into clearly organised logic.