Why does stepper move slower in one direction?

I want one move forward and backward 180 degrees why does it move in one direction slower when the button is pressed

/*



*/

#include <VarSpeedServo.h> 

VarSpeedServo myservo;


const int servoPin = 6;
int SwitchPin = 7;
int switchstate = 0;
int lastswitchstate = 0;

void setup() { 
 pinMode(SwitchPin, INPUT_PULLUP);
 
 myservo.attach(servoPin);  
 myservo.write(0,180,true);
 myservo.write(180,0,true);
} 

void loop() {

 switchstate = digitalRead(SwitchPin);

 if (switchstate != lastswitchstate) {
 if (switchstate == LOW) {
 myservo.write(0,180,true);
 myservo.write(180,0,true);           
 
}
 lastswitchstate = switchstate;


} 
}

cenkgursu:
I want one move forward and backward 180 degrees why does it move in one direction slower when the button is pressed

Because that's what you have asked it to do. Take a careful look at what the 3 parameters to a VarSpeedServo write() command are for (HINT, the second parameter is called 'speed').

Steve

library code is defined as 0 full speed. I say 180 degrees with full speed but it moves slower in one direction

@cenkgursu, your title is incorrect as it refers to a stepper motor when, in fact, you are using a servo. If you edit your Original Post you can modify the title.

...R

Read it again:
"speed varies the speed of the move to new position 0=full speed, 1-255 slower to faster"

 myservo.write(0,180,true);
 myservo.write(180,0,true);

First line - move to position 0 at speed 180 (not full speed), wait for it to get there.
Second line - move to position 180 at speed 0 (full speed), wait.

Steve