Read RPM and SPEED from ECU EDC15

I can confirm that the code works (with the pins changed) on an Arduino Uno R3, with pulses sent from a function generator.

I am using pins D2 and D3, for r.p.m and speed.

Here is an oscilloscope trace showing a frequency of 100Hz (=3000rpm) applied to pin D2, and 71Hz (=100 mph/kmph) applied to D3, together with the results from the serial monitor:

The speed is reading 3002 rpm rather than 3000 rpm because my Arduino clock frequency is not exactly 16MHz.