//pin numbers for plus, minus, reset and mode buttons
const int buttonPlus = 4;
const int buttonMinus = 5;

//variables
int garmCount = 0;//integer for number of garments


//button state variables for each button
int buttonPlusState = 0;
int lastButtonPlusState = 0;
int buttonMinusState = 0;
int lastButtonMinusState = 0;
int buttonRstState = 0;
int lastButtonRstState = 0;
int buttonModeState = 0;
int lastButtonModeState = 0;

void setup() {
    // put your setup code here, to run once:
    //initialise all buttons as inputs
    pinMode(buttonPlus, INPUT);
    pinMode(buttonMinus, INPUT);

    //initialise display
    Serial.begin(9600);
}

void loop() {
    // read state of plus button
    buttonPlusState = digitalRead(buttonPlus);

    // compare plus button state to previous state, increment garm count if pressed
    if (buttonPlusState != lastButtonPlusState) {
        if (buttonPlusState == HIGH) {
            garmCount++;
            Serial.println (garmCount);
        }
        delay(50);//debounce
    }
    //update plus button state for next loop
    lastButtonPlusState = buttonPlusState;

    //read minus state
    buttonMinusState = digitalRead(buttonMinus);

    // compare minus button state to previous state, decrease garm count if pressed
    if (buttonMinusState != lastButtonMinusState) {
        if (buttonMinusState == HIGH) {
            --garmCount;
            Serial.println (garmCount);
        }
        delay(50);//debounce
    }
    //update minus button state for next loop
    lastButtonMinusState = buttonMinusState;

}