Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. local out = "right"
  2. local message = "Cell not detected, checking again in 30 seconds"
  3. local cell = peripheral.wrap("top")
  4. local CellStored = cell.getEnergyStored("top")
  5. local CellFull = cell.getMaxEnergyStored("top")
  6. local cellPercent = math.floor(100*CellStored/CellFull)
  7.  
  8. while true do
  9. if cell == true then
  10. print(tonumber(CellStored).."/"..CellFull.." "..cellPercent.."%")
  11. if CellStored == CellFull then
  12. rs.setoutput(out, true)
  13. sleep(1)
  14. rs.setoutput(out, false)
  15. else
  16. sleep(5)
  17. end
  18. else
  19. print(message)
  20. sleep(30)
  21. end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement