Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. -- Find all of our peripherals
  2. battery = peripheral.wrap("bottom")
  3.  
  4. -- Check if we have a battery
  5. if battery == nil then
  6. error("ER: No battery connected to computer")
  7. end
  8.  
  9. while true do
  10.  
  11. local maxEnergy = matrix.getMaxEnergy()/2.5
  12. local currEnergy = matrix.getEnergy()/2.5
  13.  
  14. battery.getEnergy()
  15.  
  16. if currEnergy / maxEnergy < 0.5 then
  17. redstone.setAnalogOutput("back", 15)
  18. end
  19. os.sleep(2)
  20.  
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement