PDA

View Full Version : Melanie's Olympic Timer



Macgman2000
- 18th May 2010, 16:34
Hello,

I have an application where I need to take time and convert it to speed in MPH. I am using Melanie's
timer to get time, I want to convert the time after the timer stops to MPH. How can I modify the
code such that I don't screw up the accuracy of the timing it keeps?

Any help is very much appreciated!!!

Nick

Tobias
- 29th May 2010, 03:59
Add a routine and use after each 'time' calculation. Use her variables to calculate. To calculate the MPH you are going to have to either hard code in the distance or use inputs, ie switch panel and display, to adjust measured distance.

Elapsed Time (seconds)
Distance(feet)

MPH = (Distance/5280 (calculates percentage of one mile)) / (Elapsed Time / 60 (to get to minutes) / 60 ( to get to one hour))

Example

Elapsed time = 30 seconds
Distance = 2 miles

MPH = (10560/5280)/(30/60/60)
MPH = 2/0.0083
MPH = 240