Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function sendID(ID) -- ID is a number which is tracked outside of this function, it should always be between 1 and 15
- redstone.setAnalogOutput("front", ID) -- turn on redstone
- repeat
- print("waiting for confirmation")
- os.pullEvent("redstone")
- until redstone.getInput("front") -- this works directly against the turtle but not if there is redstone
- redstone.setAnalogOutput("front", 0) -- turn off redstone
- end
- local function reciveID()
- while redstone.getAnalogInput("back") == 0 do -- if no signal then wait for one
- os.pullEvent("redstone")
- end
- os.setComputerLabel("T"..tostring(redstone.getAnalogInput("back"))) -- signal strength is our number
- redstone.setOutput("back", true) -- send confirmation signal
- while redstone.getAnalogInput("back") ~= 0 do -- if the ID signal is still there then they haven't seen our confirmation yet
- os.pullEvent("redstone") -- when the ID signal is gone then they have seen our confirmation
- end
- redstone.setOutput("back", false) -- turn off confirmation signal
- end
Advertisement
Add Comment
Please, Sign In to add comment