Skip to content

Instantly share code, notes, and snippets.

@brentpicasso
Created June 21, 2018 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brentpicasso/222dc8959d8afa70da7c9e0d22289944 to your computer and use it in GitHub Desktop.
Save brentpicasso/222dc8959d8afa70da7c9e0d22289944 to your computer and use it in GitHub Desktop.
Predicted time simulator + alternating TimeDelta, for testing UI
setTickRate(2)
delta = 0
dir = 0.05
did = addChannel('TimeDelta2', 50, 2, -10, 10, 'sec')
pid = addChannel('PredTime', 10, 4, 0, 5, 'min')
clid = addChannel('CurrentLap', 50, 0)
lcid = addChannel('LapCount', 50, 0)
maxval = 3
pt = 99.34
setChannel(pid, pt)
setChannel(clid, 3)
setChannel(lcid, 2)
function onTick()
if delta >= maxval or delta <= -maxval then dir = -dir end
delta = delta + dir
setChannel(did, delta)
local r = (math.random() - 0.5) * .01
println(r)
setChannel(pid, pt + r)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment