Calculating Speed with Two Sensors

Lol, that's what makes programming a challenge! :wink:

How does the analog sensor work? Do you have a part number or datasheet? Depending on how it works, it might benefit with a pulldown resistor.