Hi everybody
I've played around with rednet a little bit and wrote a little program, which doesn't work correctly.. Here is what it should do:
If it gets the command, it should extend a pisten and with another command it should retract it
Now here's the problem: It only extends and does not retract... here's the code of my receiver computer(id4)
rednet.open("left")
while true do
os.pullEvent()
id,message = rednet.receive()
if message == "on" then
rs.setOutput("back", true)
end
if message == "off" then
rs.setOutput("back", false)
end
end
what is wrong/missing there? I would be glad if someone could help me


Rednet help
Started by Abstract, Oct 25 2012 05:03 PM
2 replies to this topic
#1
Posted 25 October 2012 - 05:03 PM
#2
Posted 25 October 2012 - 05:11 PM
You're not using os.pullEvent() for anything, but it still pulls events off the event queue and makes the event unavailable for rednet.receive(). So half of your events are being discarded without being used. Try sending "off" multiple times. Or just remove the os.pullEvent() call, you're not using it anyway.
#3
Posted 25 October 2012 - 05:13 PM
thanks, that worked
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users