Advertisement
marko_rus

tablet os

Oct 26th, 2018
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. --DEMO
  2. comp = require("computer")
  3. component = require("component")
  4. --tablet = component.tablet
  5. event =require("event")
  6. gpu =component.gpu
  7. internet = require("internet")
  8. shell =require("shell")
  9. term =require("term")
  10. sx = 55
  11. sz = 36
  12. local n = 2
  13. local cx, cz, background
  14.  
  15. function timer()
  16. bv2 =math.floor((comp.energy()/comp.maxEnergy())*100)
  17. cx, cz =term.getCursor()
  18. --if bv2 ~= bv1 then
  19. background =gpu.getBackground()
  20. gpu.setBackground(0x00FF00)
  21. term.setCursor(1,1)
  22. term.clearLine()
  23. print("battery: " .. bv2 .. "%" .. " free ram: " .. math.floor((comp.freeMemory()/1024)) .. "kb")
  24. gpu.setBackground(0xFFFF4c)
  25. --end
  26. term.setCursor(cx, cz)
  27. end
  28.  
  29. term.clear()
  30. gpu.setResolution(sx, sz)
  31. gpu.setBackground(0x00FF00)
  32. gpu.fill(1, 1, 55, 1, " ")
  33. print("battery: " .. math.floor((comp.energy()/comp.maxEnergy())*100) .. "%" .. " free ram: " .. math.floor((comp.freeMemory()/1024)) .. "kb")
  34. gpu.setBackground(0xFFFF4c)
  35. gpu.fill(1, 2, sx, sz, " ")
  36. bv1 = math.floor((comp.energy()/comp.maxEnergy())*100)
  37.  
  38. event.timer(1, timer, math.huge)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement