Camshafts Mesurements Project

Also you'll get an order of magnitude speed up in the interrupt routine if you replace digitalRead/Write with direct port manipulation.