I have this script that I wrote to control a piston door via redstone and on the other side of the door I have a motion sensor to open the piston door (toggle the redstone signal on). For some reason the motion sensor isn't doing anything, though. I know it's something I did, I'm new to LUA.
local component =require("component")local sides =require("sides")localevent=require("event")local gpu = component.gpu
local term =require("term")local rs = component.redstone
--Configlocal delay =5whiletruedo-- GUI
term.clear()
gpu.setForeground(0x00FF00)print("--------------------------- ToNELvision MICROSYTEMS ---------------------------\n")
gpu.setForeground(0xFFFFFF)print("Welcome. Please enter one of the displayed commands. It may take a few seconds for the command to be interpreted.\n")
gpu.setForeground(0xE6AB38)print("Open")print("Close")
gpu.setForeground(0xFFFFFF)
term.setCursor(1,9)local input=io.read()if input =="Open"then
rs.setOutput(side.right,15)
os.sleep(delay)
rs.setOutput(side.right,0)else
wrong =trueend--MotionSensorlocal id, _, x, y, entityName =event.pull("motion")
rs.setOutput(sides.right,15)
os.sleep(delay)
rs.setOutput(sides.right,0)end
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
I have this script that I wrote to control a piston door via redstone and on the other side of the door I have a motion sensor to open the piston door (toggle the redstone signal on). For some reason the motion sensor isn't doing anything, though. I know it's something I did, I'm new to LUA.
Link to post
Share on other sites