Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --read analog signal and output power signal
- rs_in_side = "back"
- rs_out_side = "left"
- inputRedstoneLevel = 15
- isPowerOutput = false
- --update data from redstone channels (sensors)
- function UpdateSensors()
- inputRedstoneLevel = rs.getInput(rs_in_side)
- if (isPowerOutput == false and inputRedstoneLevel < 5) then
- isPowerOutput = true
- end
- if (isPowerOutput == true and inputRedstoneLevel > 13) then
- isPowerOutput = false
- end
- if isPowerOutput then
- rs.setOutput(rs_out_side, true)
- else
- rs.setOutput(rs_out_side, false)
- end
- end
- UpdateSensors()
- repeat
- event,p1,p2,p3 = os.pullEvent()
- if event=="redstone" then
- UpdateSensors()
- end
- until event=="char" and p1==("q")
Add Comment
Please, Sign In to add comment