Vehicle speed sensor

Your delay() is for 1 second. That analogWrite() only updates every second.

You could actually update that on every pulse received without resorting to setting counter bits.
I'm not joking, 7ms is a long time to Arduino.

A false VSS above 40? Trying to avoid speeding tickets?