The problem is, I don't get any errors, but the computer never receives the message and I am at a loss here.
Here is my code:
Main computer that sends message:
This generates a number between 20-29, I have 5 computers connected so if it generates 20-25 it uses it as the ID and sends the message "back5000" to be handled by the if statement to enable the back redstoneOut for 5 seconds, but if it's above that, it subtracts 5 and uses it as the id and returns "bottom5000" - so basically 1 computer controls 2 outputs (back or bottom)
rednet.open("right")
math.randomseed(os.time())
while true do
os.pullEvent("redstone")
if rs.getInput("back") then
lightid = math.random(20,29)
if(lightid < 26) then
idfinal = lightid
output = "back5000"
else
idfinal = lightid - 5
output = "bottom5000"
end
print("Output for ID: "..idfinal..") "..output)
rednet.send(idfinal, output)
end
end
Recieving computers:
function on(direction)
rs.setOutput(direction, true)
end
function off(direction)
rs.setOutput(direction, false)
end
rednet.open("top")
while true do
print("Waiting for input...")
id, message = rednet.receive()
if message == "back5000" then
on("back")
os.sleep(5000)
off("back")
elseif message == "bottom5000" then
on("bottom")
os.sleep(5000)
off("bottom")
else
on(message)
os.sleep(.50)
off(message)
end
end
The first computer outputs correctly, but I am unsure if it's sending the message.
The receiving computers don't receive anything, they just say "Waiting on input…"
Could someone help me figure out why this isn't working?