Hi Erel,
This code excerpt runs fine on the desktop, however, on the device the number shown ( d ) when you press stop is always a multiple of 331 or a second. I observed this since Ver 5.8
This code excerpt runs fine on the desktop, however, on the device the number shown ( d ) when you press stop is always a multiple of 331 or a second. I observed this since Ver 5.8
B4X:
Sub buttLightStart_Click
'Hint: Press as you see the lightning
lightning = Now 'REM: lightning is global
End Sub
Sub buttLightStop_Click
'Hint: Press as you hear the thunder
Dim d
d= (Now - lightning) / cTicksPerSecond * 331
imgButtResult.Text = "Distance: " & d & " meters, " & Round(d * 3.281) & " feet"
End Sub
Last edited: