Advertisement
avartoon15

redston

Oct 23rd, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. local input = peripheral.wrap("IE:hvCapacitor_4")
  2. local output = peripheral.wrap("IE:hvCapacitor_5")
  3.  
  4. function input()
  5.   inputenergy = input.getEnergyStored() / input.getMaxEnergyStored()
  6.   inputenergy = inputenergy * 100
  7. end
  8.  
  9. function output()
  10.   outputenergy = output.getEnergyStored() / output.getMaxEnergyStored()
  11.   outputenergy = outputenergy * 100
  12. end
  13.  
  14. function energy()
  15.   input()
  16.   output()
  17.   energy = inputenergy + outputenergy
  18.   energy = energy / 2
  19. end
  20.  
  21. while true do
  22.   energy()
  23.   if energy >  95 then
  24.     rs.setOutput("top", false)
  25.   else
  26.     if energy < 25 then
  27.       rs.setOutput("top", true)
  28.     end
  29.   end
  30. print(energy)
  31. sleep(1)
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement