Software button debounce.

Is there a software debounce for these buttons since they are on interrupts? Or what is the best way to stop bouncing?

//PSPS for use in Arduino IDE.             Corresponding ATMega328P-AU TQFP32 pin

const int cutOut = 1;                               //31
const int  buttonPinOff = 0;                      // the pin that the OFF interupt pushbutton is attached to
const int  buttonPinOn = 1;                         // the pin that the ON interupt pushbutton is attached to
const int solenoid = 4;                             // solenoid connected to digital pin 4 on arduino.
int const cutIn = 5;                                //32
int const pumpPin = 6;                             //1

// include the library code:  
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd (7,8,9,10,11,12);          //11RS,12E,13D4,14D5,15D6,16D7

//LED Stuff1of3 
int led = 13;                                //16


int mpxVal = 0;
int mpxValBar = 0;
const int MIN_mpxPin= 0;                     //constraint stuff
const int MAX_mpxPin= 1023;                  //constraint stuff
const int MIN_mpxPinBar= 0;                     //constraint stuff
const int MAX_mpxPinBar= 1023;                  //constraint stuff
int mpxPin = A0;                            //23 



// Variables will change:
volatile int buttonPushCounterOn = 0;            // counter for the number of button presses
volatile int buttonPushCounterOff = 0;           // counter for the number of button presses
volatile int buttonStateOn = 0;                      // current state of the button
int buttonStateOff = 0;                     // current state of the button
int lastButtonStateOn = 0;                     // previous state of the On button
int lastButtonStateOff = 0;                  // previous state of the Off button */





//BLINK WITHOUT DELAY STUFF
long previousMillis = 0;        // will store last time millis updated




void setup(){
  pinMode(solenoid, OUTPUT);                // sets the digital pins as in/output
  pinMode(cutIn, INPUT);
  pinMode(cutOut, INPUT);
  pinMode(pumpPin, OUTPUT);
  pinMode(buttonPinOn, INPUT);
  pinMode(buttonPinOff, INPUT);

  //LED Stuff2of3
  pinMode(led, OUTPUT);

  //Serial Stuff1of2
  //Serial.begin(9600);

  lcd.begin(16,2);                          // set up the LCD's number of columns and rows:
  lcd.print("www.MISTFITZ.com");            // Print a message to the LCD.
  delay(4000);
  lcd.clear();
  lcd.setCursor(2,1);
  lcd.print("-S.ON");
  lcd.setCursor(10,1);
  lcd.print("-M.OFF");


  attachInterrupt(buttonPinOn, isr1 ,RISING);
  attachInterrupt(buttonPinOff, isr2 ,RISING); 

}

void isr1()
{ 
  buttonPushCounterOn+=1;
  if(buttonPushCounterOn > 60)buttonPushCounterOn =0;    // rollover after 60.
}

void isr2()
{
  buttonPushCounterOff+=1;
  if(buttonPushCounterOff > 60)buttonPushCounterOff =0;   // rollover after 60.

}
void loop(){ 

  //Read the MPX sensor
  mpxVal = analogRead(mpxPin);

  //Do the PSI /Bar maths.. incomplete 
  mpxVal = map(mpxVal*.98, MIN_mpxPin, MAX_mpxPin, 0,101);
  mpxVal = constrain(mpxVal*.98, 0, 101);
  mpxValBar = map(mpxValBar*.98, MIN_mpxPinBar, MAX_mpxPinBar,0,7);
  mpxValBar = constrain(mpxValBar*.98, 0, 7);


  //Serial Stuff2of2
  //Serial.println(mpxVal, DEC); // Display pressure value.
  //delay (400);


  // On/Off Pressure Selection Switches
  //ON LOGIChigh: If the "on" slide switch is HIGH (indicating we want on at 40) and the pressure is  40 or less the pump will turn on at 40.
  if (digitalRead(cutIn) == HIGH && mpxVal <= 40){
    digitalWrite(pumpPin, HIGH);
    digitalWrite(led, HIGH);
  }
  //ON LOGIClow: But if the "on" slide switch is LOW (indicating we want on at 80)and pressure is 50 or less the pump will turn on at 50.
  else if (digitalRead(cutIn) == LOW && mpxVal <= 50){
    digitalWrite(pumpPin, HIGH);
    digitalWrite(led, HIGH);
  }

  //OFF LOGIChigh: If the "off" slide switch is HIGH (indicating we want off at 60) and the pressure is 60 or greater the pump will turn on at 60.
  if (digitalRead(cutOut) == HIGH && mpxVal >= 60){
    digitalWrite(pumpPin, LOW);
    digitalWrite(led, LOW);
  }
  //OFF LOGIClow: If the "off" slide switch is LOW (indicating we want off at 70) and the pressure is 70 or greater the pump will turn on at 70.
  else if (digitalRead(cutOut) == LOW && mpxVal >= 70){
    digitalWrite(pumpPin, LOW);
    digitalWrite(led, LOW);
  } 




  //BLINK WITHOUT DELAY 

  {
    unsigned long currentMillis = millis();
    if(currentMillis  > previousMillis) {
      if(digitalRead(solenoid)){
        digitalWrite(solenoid,LOW);
        previousMillis = currentMillis + buttonPushCounterOff * 1000;
      } 
      else {
        digitalWrite(solenoid,HIGH);
        previousMillis = currentMillis + buttonPushCounterOn *1000;  //Will change to 60000 for minutes.
      }
    }


    // (note: line 1 is the second row, since counting begins with 0):

    // print current pressure value:  PSI
    lcd.setCursor(1,0); 
    lcd.print("   ");
    lcd.setCursor(2, 0);
    lcd.print(mpxVal, DEC);
    lcd.print("PSI / ");


    // print current pressure value: Bar
    lcd.setCursor(9,0);
    lcd.print(" ");
    lcd.print(mpxValBar, DEC);
    lcd.setCursor(12, 0);  
    lcd.print("Bar");

    lcd.setCursor(1,1);
    lcd.print(" ");
    lcd.setCursor(0,1);
    lcd.print(buttonPushCounterOn,DEC);

    lcd.setCursor(9,1);
    lcd.print(" ");
    lcd.setCursor(8,1);
    lcd.print(buttonPushCounterOff,DEC);
  }
}

Is there a software debounce for these buttons since they are on interrupts?

Record when an interrupt happens. Check now against then, in the ISR, and ignore any interrupt that happens too soon after the last one.

If these are real physical buttons I wouldn’t bother with the software debounce. I would just put a 10k resistor and 0.1 to 1 uF cap.
see attached. Some people prefer software debounce. I’m a H/W person and find H/W more reliable.

SwitchDebounce2.jpg

I'm a hardware guy too, but I like the software time check method - then you can do a press & hold thing, and control how fast the button presses can re-occur. Like press and hold, if after 250mS is still low allow another button press action to occur. Other methods can require that the button be released before it is recognized as a valid press again. Lots of possibilities, implementation depends on your requirement.

solenoid connected to digital pin 4 on arduino

Ok, I'm sure it's not a direct connection, but hopefully the solenoid has a clamping diode or snubber circuit. Otherwise, the spikes from energizing/de-energizing solenoids will create havoc.

You are using pins 0 and 1 for push buttons...take a look here: http://forum.arduino.cc/index.php?topic=74704.0

You may want to check out this thread. It is dealing with exactly what you are asking about, debouncing.

Any tips on the code for this? Por favor?

Clearly you've invested NO effort in trying anything, but just to get you to quit whining:

unsigned long lastSwitchOnTime  = 0;

void isr1()
{
  if(millis() - lastSwithOnTime > 5) // Ignore any events that happen within 5 milliseconds of the last one
  {
     buttonPushCounterOn+=1;
     if(buttonPushCounterOn > 60)buttonPushCounterOn =0;    // rollover after 60.
  }
  lastSwitchOnTime = millis();
}