Advertisement
Himeki

Simplified Auto Lights

Sep 30th, 2012
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. readout = "Awaiting time shift."
  2.  
  3. function clear()
  4.     term.clear()
  5.     term.setCursorPos(1,1)
  6. end
  7.  
  8. while true do
  9.     sunrise = os.setAlarm(6.00)
  10.     sunset = os.setAlarm(18.00)
  11.     event, input = os.pullEvent("alarm")
  12.     if input == sunrise then
  13.         redstone.setOutput("back", false)
  14.         clear()
  15.         print("lights off.")
  16.     elseif  input == sunset then
  17.         redstone.setOutput("back", true)
  18.         clear()
  19.         print("lights on.")
  20.     end
  21. end
  22.  
  23. clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement