relay

hello every one
i m using a relay to controll 12v dc water pump.
the relay works well but when i use if or while statements the relay always remain on. kindly guide me about this
code:
int xAxis, yAxis;
int x = 0;
int y = 0;

const int control = 9 ;
void setup() {
Serial.begin(9600); // Default communication rate of the Bluetooth module
pinMode(control, OUTPUT) ;
}
void loop() {
// Default value - no movement when the Joystick stays in the center
xAxis = 510;
yAxis = 510;

while (Serial.available() == 0) {}
x = Serial.read();
delay(10);
y = Serial.read();
delay(10);
xAxis = x * 4;
yAxis = y * 4;

// Y-axis used for forward and backward control
if (yAxis < 470) {
digitalWrite(control, HIGH);
delay(1000);
digitalWrite(control, LOW);
delay(1000);
}
else if (yAxis = 510){
digitalWrite(control, HIGH);
delay(25000);
}
else if (xAxis = 510){
digitalWrite(control, HIGH);
delay(25000);
}

}

if (yAxis = 510){Oops

Common beginner mistake: '=' is the assignment operator for setting the variable on the left to the value on the right.
You want '==', the equality operator. It compares the value on the left with the value on the right and return 1 (true) if they are equal or 0 (false) if they are not equal.