A function-definition is not allowed here before '{' token?

You need to use interrupt on checkPin otherwise you might miss some situations when button was pressed.

For Simple Timer you can find tutorial here: http://playground.arduino.cc/Code/SimpleTimer

It’s always better to read those to understand whats going on you will learn coding this way rather than just copying pieces of code.