Jharakn

Untitled

May 9th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. --power load balancer
  2.  
  3. while true do
  4. -- start waiting for events
  5. local event,arg1,arg2,arg3 = os.pullEvent()
  6.  
  7. --if a redstone input changed start the timer
  8. if event == "redstone" then
  9. timeout = os.startTimer(30)
  10. end
  11.  
  12. --if the timer event triggers then a redstone input has been unchanging for 30 secs so update the balancer
  13. if event == "timer" and arg1==timeout then
  14. if redstone.getInput("top") then
  15. redstone.setOutput("bottom", true)
  16. print("Balancer updated at "..os.time()..": Power Output Deactivated")
  17. else
  18. redstone.setOutput("bottom", false)
  19. print("Balancer updated at "..os.time()..": Power Output Activated")
  20. end
  21. end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment