tooth counter

I’m trying to create a tooth counter for an encoder wheel. At the moment I can successfully read rpm but I can’t get the tooth counter to work. Basically I’ve tried stating that when a pin is high the count++ increments. I’m pretty sure its not right but I’m not sure how to tackel this task. If anybody could give me a hand it would be appreciated.

Basically I've tried stating that when a pin is high the count++ increments. I'm pretty sure its not right

Right. It's not. What you want it to count when the pin BECOMES high, not IS high. Look at the state change detection example.

Another way is with an interrupt. You can select RISING, FALLING or CHANGE
as interrupt conditions when counting transistions.