Advertisement
Guest User

derp

a guest
Sep 2nd, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.49 KB | None | 0 0
  1. b = peripheral.wrap("left")
  2. r = peripheral.wrap("back")
  3. m = peripheral.wrap("top")
  4.  
  5.  
  6. while true do
  7. cur = b.getEnergyStored("top")
  8. max = b.getMaxEnergyStored("top")
  9. perc = cur / max * 100
  10. if perc > 95 then
  11. r.setActive(false)
  12. end
  13. if perc < 70 then
  14. r.setActive(true)
  15. end
  16. if perc < 30 then
  17. rs.setOutput("bottom",true)
  18. end
  19. if perc > 30 then
  20. rs.setOutput("bottom",false)
  21. end
  22. newperc = string.sub(tostring(perc),0,4)
  23. m.clear()
  24. m.setCursorPos(2,3)
  25. m.write(newperc.."%")
  26. sleep(0.1)
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement