Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("wget https://github.com/9551-Dev/apis/raw/main/graphir.lua")
- shell.run("wget https://github.com/9551-Dev/apis/raw/main/pixelbox_lite.lua")
- local graphir = require("graphir")
- local pixelbox = require("pixelbox_lite")
- local box = pixelbox.new(term.current())
- local graph = graphir.new(box,colors.lightGray,colors.black,true,"normal")
- while true do
- local a_x, a_y, a_z = gps.locate(5)
- os.sleep(0.5)
- local b_x, b_y, b_z = gps.locate(5)
- local delta_x = a_x - b_x
- local delta_z = a_z - b_z
- local distance = math.sqrt(delta_x^2 + delta_z^2)
- local a_x = nil
- local b_x = nil
- local b_y = nil
- local a_y = nil
- local a_z = nil
- local b_z = nil
- local speed = distance*2
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- graph:add(speed)
- graph:push()
- box:render()
- term.setCursorPos(1, 1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- print(("Current speed: %s meters/second"):format(speed))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement