int val = 0;
Doing this EVERY TIME through the loop will set the value to zero. Therefore this value NEVER changes.
Define the variable outside any function, or declaire it as a static int.
Wait untill the button is unpressed BEFORE you increment the button pressed variable
while( digitalRead(pin) == LOW) ) { } // do nothing