arduino timing sensors

I am doing an engine thats run off of an arduino but i want to track the rpm’s of the motor. I’d much prefer it if it was through code. so is there any way to count the time between when the first signal is received to the second signal.

engine_program_1.0.ino (538 Bytes)

yes you can use millis() and micros(), better is to use an interupt on the sensor and count 1000 pulses how long that takes.