Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --DEMO
- comp = require("computer")
- component = require("component")
- --tablet = component.tablet
- event =require("event")
- gpu =component.gpu
- internet = require("internet")
- shell =require("shell")
- term =require("term")
- sx = 55
- sz = 36
- local n = 2
- local cx, cz, background
- function timer()
- bv2 =math.floor((comp.energy()/comp.maxEnergy())*100)
- cx, cz =term.getCursor()
- --if bv2 ~= bv1 then
- background =gpu.getBackground()
- gpu.setBackground(0x00FF00)
- term.setCursor(1,1)
- term.clearLine()
- print("battery: " .. bv2 .. "%" .. " free ram: " .. math.floor((comp.freeMemory()/1024)) .. "kb")
- gpu.setBackground(0xFFFF4c)
- --end
- term.setCursor(cx, cz)
- end
- term.clear()
- gpu.setResolution(sx, sz)
- gpu.setBackground(0x00FF00)
- gpu.fill(1, 1, 55, 1, " ")
- print("battery: " .. math.floor((comp.energy()/comp.maxEnergy())*100) .. "%" .. " free ram: " .. math.floor((comp.freeMemory()/1024)) .. "kb")
- gpu.setBackground(0xFFFF4c)
- gpu.fill(1, 2, sx, sz, " ")
- bv1 = math.floor((comp.energy()/comp.maxEnergy())*100)
- event.timer(1, timer, math.huge)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement