Thunder & Lightning

alfcen

Well-Known Member
Licensed User
Longtime User
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

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:

alfcen

Well-Known Member
Licensed User
Longtime User
Erel, I worked around with Dimitris' dzHW.dll.
Recommendation for the hardware library: hardware.GetTickCount
Cheers
 
Top