Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ** ************************ ** --
- -- ** Train Station Controller ** --
- -- ** ************************ ** --
- local monitor = peripheral.wrap("left")
- local stationName = "name1"
- local counter = 0
- local departureWait = 30
- local redstoneSide = "back"
- function waitingPrint(counter)
- monitor.setCursorPos(1, 1)
- monitor.clear()
- monitor.setCursorPos(1, 1)
- monitor.write("Welcome to "..stationName.." station")
- monitor.setCursorPos(1, 3)
- monitor.write("Train departed "..counter.." Seconds ago")
- end
- function departingPrint(counter)
- monitor.setCursorPos(1, 1)
- monitor.clear()
- monitor.setCursorPos(1, 1)
- monitor.write("Welcome to "..stationName.." station")
- monitor.setCursorPos(1, 3)
- monitor.write("Train departing in "..counter.." Seconds")
- end
- -- Main Program Loop
- while true do
- waitingPrint(counter)
- counter = counter + 1
- sleep(1)
- if colors.test(redstone.getBundledInput(redstoneSide), colors.white) then
- sleep(2)
- redstone.setBundledOutput(redstoneSide, colors.orange)
- counter = departureWait
- while counter ~= 0 do
- departingPrint(counter)
- counter = counter - 1
- sleep(1)
- end
- redstone.setBundledOutput(redstoneSide, 0)
- sleep(2)
- redstone.setBundledOutput(redstoneSide, colors.magenta)
- sleep(2)
- redstone.setBundledOutput(redstoneSide, 0)
- end
- if counter == 1000 then
- os.shutdown()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment