Go Down

Topic: Pump Manual Mode OFF problem (Read 634 times) previous topic - next topic

harnam


I have a code for switching ON the pump ON and OFF with two modes Auto  and Manual ON

Operating conditions are if Level is 50% pump comes ON and when reaches  100% pump switches OFF
The Manual override switch when pressed, pump comes ON but it does not switch OFF when the
100% level is achieved.  The purpose of Manual ride switch is to by pass the Auto Mode for starting the pump
but it must be switched OFF to avoid overflow. Please help me to rectify the problem
Thanks
Code: [Select]
//Constants
onst int INT_LevelOff = 100; // Turn Off when this level is reached
const int INT_LevelOn = 50; // Turn On  when this level is reached
//Variable
boolean blnAutoMode;      // Holds the mode of operation True: Auto (On/Off), false: Manual (ON)
int intStatus;            // Holds the status 0: All OK, 1: Dry Run Warning 
//Void setup
// Set control to Auto mode
blnAutoMode = true;
//void loop
//Functions
switch (intStatus) {
case 0: // All OK
if (!blnAutoMode) {
lcdMyDisplay.print("Manual ON     ");
}
else {
// Auto Mode ON/OFF
if (blnPump) {
lcdMyDisplay.print("Auto ON       ");
}
else {
lcdMyDisplay.print("Auto Off      ");
}
}
break;
// Verify if Pump Should be turned on
//   ON: By the volume being less than VolOn while on Auto Mode OR by being in Manual-ON
if ( ( (intTankLevelPerCent <= INT_LevelOn) && blnAutoMode ) || !blnAutoMode ) {
              blnPump = true;
                 }
//   OFF: By the volume being more than VolOff while on Auto mode OR by being in Manual-ON
if ( ((intTankLevelPerCent >= INT_LevelOff) && blnAutoMode) || !blnAutoMode )  {
             blnPump = false;
}

AWOL

Code: [Select]
//Constants
onst int INT_LevelOff = 100;

That compiles?

Please use the auto-format tool before posting code - your indentation hurts my eyes.
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

harnam

Sorry This is a cut and paste error. As I said the code is working OK  for Auto Mode ON & OFF and
also for Manual ON it does not switch OFF automatically when 100% level is achieved. IWhat could be
wrong with the OFF code ?
Thanks

Code: [Select]
// Verify if Pump Should be turned on
//   ON: By the volume being less than VolOn while on Auto Mode OR by being in Manual-ON
if ( ( (intTankLevelPerCent <= INT_LevelOn) && blnAutoMode ) || !blnAutoMode ) {
  blnPump = true;
}
//   OFF: By the volume being more than VolOff while on Auto mode OR by being in Manual-ON
if ( ((intTankLevelPerCent >= INT_LevelOff) && blnAutoMode) || !blnAutoMode )  {
  blnPump = false;
}

wildbill

Your symptoms aren't what I would expect. When in manual mode this code:
Code: [Select]

// Verify if Pump Should be turned on
//   ON: By the volume being less than VolOn while on Auto Mode OR by being in Manual-ON
if ( ( (intTankLevelPerCent <= INT_LevelOn) && blnAutoMode ) || !blnAutoMode ) {
              blnPump = true;
                 }
//   OFF: By the volume being more than VolOff while on Auto mode OR by being in Manual-ON
if ( ((intTankLevelPerCent >= INT_LevelOff) && blnAutoMode) || !blnAutoMode )  {
             blnPump = false;

Says: if in manual mode, turn the pump on irrespective of the level but is immediately followed by a second if - if in manual mode unconditionally turn the pump off. I would have expected your problem to be that the pump never comes on in manual mode. Hard to tell without being able to see all the code (and the wiring).

Go Up