Help on pushbutton project

Good for you for looking at whether there is a change in state in a switch !

Here is a start:

   //was there a switch change in state ?
   if (buttonState != lastButtonState)
   {
     //update to this new state    
     lastButtonState = buttonState;

     //is the switch now pressed ?
     if (buttonState == PUSHED)
      {
         counter++;
         //don’t go over the maximum 
         if(counter > maximumCount)
           {
                counter = 0;
           }
      } 
     
   }