How to use EEPROM to save my settings value while the program is running.

10 cm is because the ultrasonic sensor will be at the top of the tank, so when the tank will be full when I want the distance between the ultrasonic sensor and water level to be 10 cm. 10 is not the depth of the tank.

Serial.println(Serial.available());

I used it for using the settings. Just for the beginning, I wanted to change the setting using serial monitor. so.

You don't seem to have a clue that the Arduino is not waiting (and should not wait) for serial data to arrive.

I know and that's my real problem. I'm not getting the idea how to make my Arduino wait. That's why the whole part is not working for me. I want you could make it work.

Why are you storing the minimum value in maxi?

Code: [Select]
Serial.print("Enter Your Maximum value (in cm)");
while(Serial.available()>0)
{
if(Serial.available()>0)
{
mini=Serial.read();

Why are you storing the maximum value in the mini?

"minimum" is the minimum height water level can reach before the relay starts the pump. but since the ultrasonic sensor is at the top, so for it the value in greater...

Similarly "maximum" is how high the water level should reach before the pump stops. But for Arduino, that value is smaller.

The whole point is that I made it jst for my convenience.

I think that whole setting part might be wrong. I want help in correcting that whole part and make it work.