Also you need to have some de-bounce on the counter pin if it is a mechanical switch or you will count the contact bounces as well giving false readings.
Also you need to have some de-bounce on the counter pin if it is a mechanical switch or you will count the contact bounces as well giving false readings.