Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Elevator Level 1
- -- Front : Door
- -- bottom : Button
- function ReadNet()
- print ("Running in RedNet")
- while true do
- event, id, text = os.pullEvent()
- if event == "rednet_message" then
- if text=="OpenDoor" then
- print("Opening door")
- redstone.setOutput("front",false)
- end
- if text=="CloseDoor" then
- print("closing Door")
- redstone.setOutput("front",true)
- end
- end
- end
- end
- function Work()
- print("Running in Work")
- while true do
- local event = os.pullEvent()
- if (redstone.getInput("bottom")) then
- print("Button Level 1 pressed")
- rednet.broadcast("L1ButtonPressed")
- end
- end
- end
- function main()
- print("Startup...")
- rednet.open("left")
- parallel.waitForAny(ReadNet, Work)
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement