Through trial and error, I have made some progress.
It would appear that the programe does not like Servo.sequencePlay command being used with Servo.write command
I have deleted the following lines from void loop ()
Servo2.write (164, 10);
Servo3.write (53, 10);
and replaced then with additional Servo.sequencePlay lines
Servo2.sequencePlay(doorclose, 1, false, 0);
Servo3.sequencePlay(gateclose, 1, false, 0);
having made necessary changes to void setup()
The programe now works !
This does cause some minor issues as the Sevro.sequencePlay command need to be in a 'loop' so l will need to find away to make the second servo wait for the first servo to finish.
I am not aware for a Servo.sequencePlay command that waits for the servo to finish before commencing so I may need to do this with a timer.
I do not understand why I cannot use Servo.write with Servo.sequencePlay, however the programe works so I am not complaining.
Thankyou for your help
for your information here is my new code
#include <VarSpeedServo.h>
//VarSpeedServo Servo1;
VarSpeedServo Servo2;
VarSpeedServo Servo3;
int doorSwitch = 8;
servoSequencePoint dooropen[] = {{140, 3}, {120, 6}, {100, 9}, {80, 12}, {65, 15}, {50, 20}
};
servoSequencePoint gateopen[] = {{120, 10}, {7510}, {120, 10}, {75, 10}
};
servoSequencePoint doorclose[] = {{164, 10}
};
servoSequencePoint gateclose[] = {{53, 10}
};
void setup() {
Serial.begin(9600);
//Servo1.attach(10);
Servo2.attach(11);
Servo3.attach(12);
pinMode (8, INPUT_PULLUP);
//Servo1.write (53, 10);
Servo2.write (164, 10);
Servo3.write (53, 10);
}
void loop() {
if (digitalRead (doorSwitch) == HIGH) {
Servo2.sequencePlay(dooropen, 6, false, 0);
Servo3.sequencePlay(gateopen, 4, false, 0);
}
if (digitalRead (doorSwitch) == LOW) {
Servo2.sequencePlay(doorclose, 1, false, 0);
Servo3.sequencePlay(gateclose, 1, false, 0);
}
}