Need guidance on small code

When you have trouble with switches, it is useless to show us the code without telling us how the switch is wired.

  if (digitalRead(buttonPin) == HIGH)  // check if button was pressed
  {
    buttonPresses++;                  // increment buttonPresses count
    delay(100);                       // debounce switch
  }

Wrong. You want to increment the counter when the switch BECOMES pressed, not IS pressed. Look at the state change detection example.

100 milliseconds is FAR too long for debouncing.

  if (lastPressCount != buttonPresses)              // only do output if the count has changed

Look at the modulo operator (%), instead. Do something when the count is even (%2 == 0) and something else when the count is odd.