control rpm of a motor

As my signoff tells:
Try the "blink without delay" sketch, and see what that's about.
Once you understand that, you'll know how to do your periodical RPM test without interfering (too much) with the rest of your sketch.