Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- running = false
- startTime = os.clock()
- endTime = os.clock()
- monitor = peripheral.wrap("left")
- monitor.setTextScale(4)
- function round(num, numDecimalPlaces)
- local mult = 10^(numDecimalPlaces or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- while true do
- os.pullEvent("redstone")
- if rs.getInput("bottom") then
- running = true
- startTime = os.clock()
- print("Start: " .. startTime)
- monitor.setCursorPos(1,2)
- monitor.write(" ...")
- elseif rs.getInput("back") and running then
- running = false
- endTime = os.clock()
- print("End: " .. endTime)
- delta = round(endTime - startTime, 2)
- monitor.setCursorPos(1,2)
- monitor.write(" ")
- monitor.setCursorPos(1,2)
- monitor.write(delta)
- print(delta)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement