Ted, when the sample code uses an expression like
int ledPin = 13;
it's not really doing
anything, it's just creating a name for the pin, so that later the programmer can write code like
Using names like this helps improve code readability and makes it a lot easier to change pin assignments if you need to later.
For your application, you need to (a) detect when a button is depressed, and (b) increment the counter. To best do this, I recommend introducing 2 state variables, one which keeps track of the button and the other the counter:
int buttonState = HIGH;
int counter = 0;
Now each time through the loop, you check to see if the button is newly depressed using code like this:
int newstate = digitalRead(inputpin);
if (buttonState != newstate) // has the state changed from HIGH to LOW or vice versa?
buttonState = newstate;
if (newstate == LOW) // was the button pressed?
++counter; // then increment the counter
delay(200); // software debouncing code
So now you have code that increments a counter everytime through the loop. All that remains is to display the current value of (the last digit of) counter:
switch(counter % 10)
// code to display the digit 0 on the 7-seg display
// code to display 1
That should get you started! Good luck!