Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.