Project Help. assignment

Hi everyone, this is my first time having to use code for the arduino and was hopeing someone with more experience could check over my code. below is the requirements for the project followed by my code. Thank you.

A control system used to maintain the water level in a
sump between the levels high and low. Two transducers (HIGH and LOW) are
used to monitor the level. The water is pumped out by two pumps, P1 and P2.
The water level in the sump is to be controlled as follows:
 If the level reaches high one pump will start to pump out.
 If the level does not reach low within about 30 seconds, the second pump
will come into action. If the level does reach low before 30 second
pumping should stop.
 If the level does not reach low within about 30 seconds of the second
pump starting, an alarm is given. The alarm is sounded until the level
reaches low. If the level does reach low before 30 seconds the pumping
should stop.
 The pumps will stop when low is detected.
 To give even loading of the pumps they are to be used alternately, e.g. if
on one pump cycle P1 starts first and P2 is the ‘back up’ then on the next
cycle P2 will start first and P1 is the ‘back up’
I'm using the motor simulators to
model the two pumps. Also a potentiometer
as a ‘level’ transducer so that, say, 10% travel is ‘low level’ and 90% ‘high
level’.

int HighWaterMark = 10230.9;
int LowWaterMark = 1023
0.1;

int Pump1=8;
int Pump2=9;
int Alarm=7;
int potPin= 1;
int potvalue= A5;

// The pumps. start pumps[0] first and pumps[1] second.
// swap values when you reach the low water mark.
int pumps[2] = {Pump1, Pump2};

int delayTime = 0;

void setup() {
pinMode(Pump2,OUTPUT);
pinMode(Pump1,OUTPUT);
pinMode(Alarm,OUTPUT);
}

void loop()
{

delayTime = 0; //This is required to ensure that delayTime is 0 at the begining

//Stop pump1 if running //This is required to ensure that pump1 is at rest at the begining

//Stop pump2 if running//This is required to ensure that pump2 is at rest at the begining

int potValue = analogRead(potPin);
if(potValue>=HighWaterMark){	//if potValue exceeding the upper mark enter the loop
	//Trigger First Pump

	while(delayTime < 30000){	//delay for max 30 sec by running this loop[Note that I am not considering loop execution time, if you want to consider, take 1 or 2 sec less in the condition]
		delay(1000);//delay 1 sec
		delayTime+=1;
		int potValue = analogRead(potPin);
		if(potValue<=LowWaterMark){
			break; //If reached lower mark before 30 sec exit the loop
		}
	}

	if(delayTime >= 30000){	//SECOND PUMP Enter this loop if potValue fails to reach lower mark after 30 sec of running 1st pump
		delayTime = 0;
		int potValue = analogRead(potPin);
		if(potValue>LowWaterMark){	//if potValue is still above lower mark enter the loop
			//Trigger Second Pump

			while(delayTime < 30000){	//delay for max 30 sec by running this loop[Note that I am not considering loop execution time, if you want to consider, take 1 or 2 sec less in the condition]
				delay(1000); //delay 1 sec
				delayTime+=1;
				int potValue = analogRead(potPin);
				if(potValue<=LowWaterMark){
					break; //If reached lower mark before 30 sec exit the loop
				}
			}

			if(delayTime >= 30000){	//ALARM Enter this loop if potValue fails to reach lower mark after 30 sec of running 2nd pump

				delayTime = 0;
				int potValue = analogRead(potPin);

				//Trigger alarm
				while(potValue>LowWaterMark){	//delay until potValue reach lower mark
					int potValue = analogRead(potPin);

					// delay for few time in between(optional)
				}
				//Stop the alarm
			}
			//Stop pump2
		}
	}
	//Stop pump1
	// swap pumps[0] and pumps[1] so the next time you'll use them in the opposite order
}
//sleep(1); or delay(1000); if you want to give rest

}

int HighWaterMark = 10230.9;

What do you understand "int" to be a contraction of?

Please remember to use code tags when posting code

abbreviation

No, not abbreviation, it's "integer".

Good try though.

"int" is not a contraction of anything. It is an abbreviation of something.
And yes, it was a good.

other than code tags does the code look good ?
thanks

int HighWaterMark = 10230.9;
int LowWaterMark = 10230.1;
...
...

int potValue = analogRead(potPin);
if(potValue>=HighWaterMark)

Talk us through that bit

i couldn't follow the posted code with all the nested loops.

consider

#undef MyHW
#ifdef MyHW
const int Pump1  = 10;
const int Pump2  = 11;
const int Alarm  = 13;

const int potPin = A0;
#else
const int Pump1 = 8;
const int Pump2 = 9;
const int Alarm = 7;

const int potPin =  A5;
#endif

enum { Off = HIGH, On = LOW };

byte pins [] = { Pump1, Pump2, Alarm };
#define N_PINS  sizeof(pins)

const int HighWaterMark = 800;
const int LowWaterMark  = HighWaterMark - 50;

const unsigned long ThirtySec = 30000;

unsigned long delayTime;
unsigned long msec;
int           potValue;

void setup ()
{
    Serial.begin (9600);

    for (unsigned n = 0; n < N_PINS; n++)  {
        digitalWrite (pins [n], Off);
        pinMode      (pins [n], OUTPUT);
        Serial.println (pins [n]);
    }
}

void loop ()
{
    unsigned long msec = millis ();

    potValue = analogRead (potPin);
    Serial.println (potValue);

    if (LowWaterMark > potValue)  {
        digitalWrite (Pump1, Off);
        digitalWrite (Pump2, Off);
        digitalWrite (Alarm, Off);
    }

    else if (HighWaterMark < potValue) {
        if (Off == digitalRead (Pump1))         // capture timestamp
            delayTime = msec;

        else if (Off == digitalRead (Pump2))  {
            if ( (msec - delayTime) > ThirtySec)  {
                delayTime = msec;
                digitalWrite (Pump2, On);       // start pump 2
            }
        }    
        else  {
            if ( (msec - delayTime) > ThirtySec)  {
                digitalWrite (Alarm, On);
            }
        }

        digitalWrite (Pump1, On);
    }
}