AWOL thanks so much for your help.
I was able to look over your code, multiply it and adjust it to suit my application and it works great!!!
Here is the code for my application ( calibration of 4 pumps ):
int cal_button = 9; // Select the input pin for the button array
int pump_1 = 4; // Select the pin for dose pump 1 output
int pump_2 = 5; // Select the pin for dose pump 2 output
int pump_3 = 6; // Select the pin for dose pump 3 output
int pump_4 = 7; // Select the pin for dose pump 4 output
int val = 0; // Variable to store the analog value coming from the calibrate button array
byte state1 = 0; // Variable to store the output state of dose pump 1
long end1;
byte state2 = 0; // Variable to store the output state of dose pump 2
long end2;
byte state3 = 0; // Variable to store the output state of dose pump 3
long end3;
byte state4 = 0; // Variable to store the output state of dose pump 4
long end4;
void setup() {
pinMode(pump_1, OUTPUT); // Set the Pin as an OUTPUT
pinMode(pump_2, OUTPUT); // Set the Pin as an OUTPUT
pinMode(pump_3, OUTPUT); // Set the Pin as an OUTPUT
pinMode(pump_4, OUTPUT); // Set the Pin as an OUTPUT
Serial.begin(9600);
}
void loop() {
// **************************************** PUMP 1 *************************************************************
switch (state1) {
case 0:
val = analogRead(cal_button);
Serial.print( val );
if ((val>500)&&(val<600)){ // Activate dose pump 1 if analog value of switch is between 500 & 600
digitalWrite (pump_1, HIGH);
end1 = millis () + 60000; // Activate for 60 seconds
state1 = 1;
}
break;
case 1:
if (end1 <= millis ()) {
digitalWrite (pump_1, LOW); // After time delay, turn dose pump 1 off
state1 = 0;
}
break;
}
// **************************************** PUMP 2 *************************************************************
switch (state2) {
case 0:
val = analogRead(cal_button);
Serial.print( val );
if ((val>600)&&(val<700)){ // Activate dose pump 2 if analog value of switch is between 600 & 700
digitalWrite (pump_2, HIGH);
end2 = millis () + 60000; // Activate for 60 seconds
state2 = 1;
}
break;
case 1:
if (end2 <= millis ()) {
digitalWrite (pump_2, LOW); // After time delay, turn dose pump 2 off
state2 = 0;
}
break;
}
// **************************************** PUMP 3 *************************************************************
switch (state3) {
case 0:
val = analogRead(cal_button);
Serial.print( val );
if ((val>700)&&(val<800)){ // Activate dose pump 3 if analog value of switch is between 700 & 800
digitalWrite (pump_3, HIGH);
end3 = millis () + 60000; // Activate for 60 seconds
state3 = 1;
}
break;
case 1:
if (end3 <= millis ()) {
digitalWrite (pump_3, LOW); // After time delay, turn dose pump 3 off
state3 = 0;
}
break;
}
// **************************************** PUMP 4 *************************************************************
switch (state4) {
case 0:
val = analogRead(cal_button);
Serial.print( val );
if ((val>800)&&(val<900)){ // Activate dose pump 4 if analog value of switch is between 800 & 900
digitalWrite (pump_4, HIGH);
end4 = millis () + 60000; // Activate for 60 seconds
state4 = 1;
}
break;
case 1:
if (end4 <= millis ()) {
digitalWrite (pump_4, LOW); // After time delay, turn dose pump 4 off
state4 = 0;
}
break;
}
}
VR