Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --left: emergency kill switch
- --back: light sensor
- --right: output for lights
- function setLights(status)
- if (status ~= "on" and status ~= "off") then
- print("invalid status")
- return
- end
- if (status == "on") then
- rs.setOutput("right", true)
- elseif (status == "off") then
- rs.setOutput("right", false)
- end
- end
- kill = false
- while (kill ~= true) do
- if (rs.getInput("left") == true) then kill = true end
- if (rs.getInput("back") == true) then
- setLights("off")
- elseif (rs.getInput("back") == false) then
- setLights("on")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment