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!