Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 3x3 rednet Piston Door with Monitor Functionality
- -- Using ComputerCraft Computer
- -- By Surferpup v. 2.4
- -- Turns all red net signals off
- function clearOutputs()
- for i, side in ipairs(rs.getSides()) do
- rs.setBundledOutput(side,0)
- print(side)
- end
- end
- -- Toggles Piston
- function pulseOnOff(side,color,pulseLength,wait)
- pulseLength=pulseLength or 0
- wait = wait or .08
- local currentState = rs.getBundledOutput(side)
- rs.setBundledOutput(side,currentState+color)
- sleep(pulseLength)
- rs.setBundledOutput(side,currentState)
- sleep(wait)
- end
- -- New Line function for monitor
- function newline(monitor)
- local _,lY=monitor.getSize()
- local _,cY=monitor.getCursorPos()
- print(cY .. " " .. lY)
- if cY>=lY then
- monitor.clear()
- cY=0
- end
- monitor.setCursorPos(1,cY+1)
- end
- -- Begin
- local mon = peripheral.wrap("monitor_0") -- Comment if no monitor
- mon.clear() -- Comment if no monitor
- mon.setCursorPos(1,1) -- Comment if no monitor
- mon.setTextScale(1) -- Comment if no monitor
- clearOutputs()
- local input="top"
- local side = "top"
- while true do
- os.pullEvent("redstone")
- if rs.testBundledInput(input,colors.red) then
- local time = os.time()
- print("Door Opening: " .. textutils.formatTime(time,false))
- mon.write("Door Opening: " .. textutils.formatTime(time,false)) -- Comment if no monitor
- newline(mon) -- Comment if no monitor
- pulseOnOff(side,colors.orange+colors.gray,.09,.12) --3 & 1 -- 1 gray
- pulseOnOff(side,colors.blue,.12,.1) --2 -- 323 orange/pink
- pulseOnOff(side,colors.lightBlue) --5 -- x /blue
- pulseOnOff(side,colors.gray+colors.purple,nil,.12) --2 -- BBB
- pulseOnOff(side,colors.pink+colors.yellow,nil,.1) -- 3 -- 3 BBB 3
- pulseOnOff(side,colors.lime,.1) -- 3 BBB 3 /orange
- pulseOnOff(side,colors.yellow) -- B B
- pulseOnOff(side,colors.purple) -- y 4 lime/purple
- sleep(10) -- 5 lightBlue
- pulseOnOff(side,colors.orange+colors.pink+colors.yellow,nil,.1) -- 6 yellow
- pulseOnOff(side,colors.lime,nil,.1)
- pulseOnOff(side,colors.yellow)
- time = os.time()
- print("Door Reset ".. textutils.formatTime(time,false))
- mon.write("Door Reset ".. textutils.formatTime(time,false)) -- Comment if no monitor
- newline(mon) -- Comment if no monitor
- end
- end
- -- Chart Key
- -- B Door Block (Cobblestone, etc.)
- -- 1 Sticky Piston gray
- -- 2 Sticky Piston pink
- -- 3 Sticky Piston orange
- -- 4 Sticky Piston purple
- -- 5 Sticky Piston lightBlue
- -- 6 Sticky Piston yellow
- -- x Rednet wire connection pink
- -- y Rednet wire connection lime
Advertisement
Add Comment
Please, Sign In to add comment