We are doing a project for class where we need to do a radar gun. We are using an Arduino Due and a Lidar lite v4, we have a code that is able to measure distance but we need also to measure the speed of an object.
Here we attach the code and we would like your help to fix it.
Speed is the change in distance over time. Note the time (millis()? micros()?) of two consecutive distance measurements. Subtract the old time from the new time to get the time interval. Subtract the old distance from the new distance to get the change in distance. Divide the change in the distance by the time interval to get speed. Adjust units to your liking.