As a side project, I put together a circuit that counts the number of times a switch has been pressed in binary. It displays the count using a row of six LEDs, and was built/written using the Arduino Button and Loop examples as a starting point. The Arduino code is online here.