When Geoff and I were driving around Germany with Christian Schmitz of MBS Software before the MBS Xojo Conference started, the topic of speed limits on the autobahn came up. Christian mentioned than many cars in Germany have the speedometer set to display a speed that is a little higher than what you are actually doing. I have noticed that my Toyota Tacoma shows 70mph on the speedometer when it is really going more like 67.
Geoff wondered if there was a way to determine how accurate your car’s speedometer was and it made me think of a Xojo iOS app I had made a while ago: Xojo Speed.
Run Xojo Speed on your iPhone while you’re driving and it uses the iOSLocation class to calculate the miles per hour or kilometers per hour in a large, easy-to-read display.
This app is super simple. On the iOSLocation control that is on the view (SpeedTracker), the LocationChanged event provides a speed parameter that is in meters per second. This can easily be converted to km/h or mph. Here is the code that is used:
// speed is meters per second Dim kph As Double = speed * 3.6 Dim mph As Double = kph / 1.60934 If UnitsSelector.Value = 0 Then SpeedLabel.Text = kph.ToText(Locale.Current, "###") UnitLabel.Text = "km/h" Else SpeedLabel.Text = mph.ToText(Locale.Current, "###") UnitLabel.Text = "MPH" End If
Download the Xojo Speed project from GitHub.
Add your #JustCode project to the week 13 forum conversation.
Download and check out earlier projects:
- Week 12: MultiTemp
- Week 11: Xojo Dojo
- Week 10: NetTank
- Week 9: Quote Web Service
- Week 8: JumpStart App Launcher
- Week 7: Pitch Tracker
- Week 6: Bubble Popper
- Week 5: Math Quiz
- Week 4: Mini-Golf ScoreKeeper
- Week 3: Dogs Up!
- Week 2: Password Generator
- Week 1: Color Picker