Time Between Two PIR Motion Sensors (Average Velocity)

Hi guys,

My project is to find the average velocity of a toy car by using two motion sensors. I put these two sensors to exact points. So I know the distance between them. I need to determine the time which the car will take to pass. My algorithm idea is as follows:
When the car passes the first sensor, a timer (I used 'timer' term but I do not know exactly) will start to count.
Then when the car passes the second sensor, the timer will stop. Thus, the average velocity will be determined with little algebra.
But I could not write the code for that. Because I could not find the appropriate function for 'timer'. I tried with 'pulseIn' function, but I could not manage. How can I do this? Do you know another helpful function for this problem.

Thanks for your help in advance!

I don't know that PIR sensors will work in this application. Consider using a LED and detector. When the beam gets broken (or reflected) the car has passed.

The function millis() returns the current number of milliseconds since the board was started. So if you save millis() when the first car passes, then subtract that from the value of millis() when the second car passes, you will know how many milliseconds went by in between.