Issue with Serial Printing when not supposed to

Howdy folks, I’m new with arduino and coding and have been tinkering with this same screen for a while trying to figure out what I did wrong/Why I’m not getting what I thought I was supposed to. I’m not able to quite nail down why it’s not working the way I was hoping.

Here’s the code:

void Float() {
if (analogRead(waterLevelFloat) == HIGH) {
if (millis()-previousPumpMillis >= intervalPump) { // Run pump every 20 Minutes.
pumpSchedule();
}
floatAlarm = “”;
floatAlarm = “Deactivated”;
if (alarmCount == 1) {
Serial.println(“Float alarm reset”);
alarmCount = 0;
}
}
else if (analogRead(waterLevelFloat)==LOW) {
previousCautionMillis = millis();
floatAlarm = “Activated”;
alarmCount = 1;
if (millis()-previousCautionMillis == 10000) {
Serial.println(“Caution: Water Level Low! Pump Disabled!”);
previousCautionMillis = millis();
Serial.print("Float Alarm: ");
Serial.println(floatAlarm);
}
digitalWrite(circulationPump,LOW);
for (j =0; j<=9 ; j++) {
digitalWrite(cautionAlarm,HIGH);
}
for (j = 10; j >= 10; j++) {
digitalWrite(cautionAlarm,LOW);
if (j == 19) {
j = 0;
}
}
}
}

Here’s the Serial when 5v is applied to my waterLevelFloat pin:

Float alarm reset
Float alarm reset
Float alarm reset
Float alarm reset
Float alarm reset
Float alarm reset
Float alarm reset
Float alarm reset
Float alarm reset
Float alarm reset
Float alarm reset
Float alarm reset

It’s “supposed to” only display this when 5v is not applied to my waterLevelFloat pin

Basically, if my water level float is too low, it’s supposed to be en emergency stop to stop my circulation pump and set off my alarm (floatAlarm) which is an output and will energize a relay on a relay shield to illuminate a red indicator light.

What am I doing wrong here as it’s printing “Float alarm reset” when 5v is applied, when it shouldn’t be as that command is only to happen if waterLevelFloat was to be HIGH.

Apologies if my code isn’t super pretty. Still learning and organizing.
Also, constructive criticism is always welcomed.

"if (analogRead(waterLevelFloat) == HIGH)"

An analog input ranges from 0 to 1023 and will almost never be exactly 1 (HIGH is another name for 1).

johnwasser:
"if (analogRead(waterLevelFloat) == HIGH)"

An analog input ranges from 0 to 1023 and will almost never be exactly 1 (HIGH is another name for 1).

Edit:
Solved. Thank you!