Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. ball = peripheral.wrap("back")
  2.  
  3. maxE = ball.getMaxEnergyStored()
  4.  
  5. function update()
  6. local dumping = false
  7. while true do
  8. pct = ball.getEnergyStored() * 100 / maxE
  9.  
  10. print("Power: " .. pct .. "%")
  11.  
  12. if pct >= 90 then
  13. dumping = true
  14. end
  15. if pct < 50 and dumping then
  16. dumping = false
  17. end
  18.  
  19. if dumping then
  20. redstone.setAnalogOutput("left", 1)
  21. else
  22. redstone.setAnalogOutput("left", 0)
  23. end
  24. sleep(5)
  25. end
  26. end
  27.  
  28. parallel.waitForAny(update)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement