Water Level Sensor

Hello,

I have a quick question regarding the water level sensor.

https://www.ebay.co.uk/i/281862570992?chn=ps&dispItem=1&adgroupid=52137191441&rlsatarget=pla-379148449620&abcId=1129946&adtype=pla&merchantid=113383974&poi=&googleloc=9046130&device=c&campaignid=974961043&crdt=0.

Im building a self watering system and I have the soil moisture sensor running just fine with the pump. I'm trying to get the wtaer level sensor to turn off the pump if the water level gets too low(stopping pump running dry)

Ive tried a bunch of different ways of doing this but the sensor will not turn off pump. Am I missing something in the code? (i'm a beginner in programming)

CODE:
int waterSensorPin = A3; //analog pin number sensor plug
int waterSensorPin; //readings
int soilMoisturePin = A0; //analog pin number sensor plug
int soilMoisture; //readings
int waterPumpPin = 7; //Digital seven to mofsat

//const int read; //readings

void setup() {
Serial.begin(9600);
//waterSensorPin = Serial.read();
//soilMoisturePin = Serial.read();
pinMode(waterPumpPin, OUTPUT); // sets pin 7 pump off and on
pinMode(waterSensorPin, INPUT);
pinMode(soilMoisturePin, INPUT);
}

void loop() {
// put your main code here, to run repeatedly:

if((analogRead(soilMoisturePin) == 1023 && (analogRead(waterSensorPin == 600)))) {
//digitalWrite(waterPumpPin, HIGH);
digitalWrite(waterPumpPin, HIGH);

}

else {
digitalWrite(waterPumpPin,LOW);
}
}

The water level at top is 650 low is 400 on calibration so I want the pump to turn off then (even if soil dry)

Thanks

  if ((analogRead(soilMoisturePin) == 1023 && (analogRead(waterSensorPin == 600))))

It is never a good idea to use equality when comparing values from analogRead() as they tend not to be stable. Use >= or <= instead and allow a little leeway with values being compared to.

In particular
analogRead(waterSensorPin == 600)seems to be unlikely to be true most of the time.

Have you tried printing the values after they are read ?

Thanks for the response! I have not tried printing the values yet. I'll have a look