Advertisement
Shterman

RDoorRec

Jan 27th, 2023
632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. print ("program started")
  2.  
  3. local messageToReceiveDown = "ROFF"
  4. local messageToReceiveUp = "RON"
  5.  
  6. local modemDirect = "bottom"
  7.  
  8. rednet.open(modemDirect)
  9.  
  10. if (rednet.isOpen(modemDirect)) then
  11.     print ("Modem is Open, Direction " ..modemDirect)
  12. else
  13.     printError("Modem not found")
  14. end
  15.  
  16. while true do
  17.     local id, message, protocol = rednet.receive()
  18.  
  19.     if (message == messageToReceiveUp) then
  20.         print("message received " ..message)
  21.         message = "a"
  22.         sleep (1)
  23.     elseif (message == messageToReceiveDown) then
  24.         print("message received " ..message)
  25.         message = "a"
  26.         sleep (1)
  27.     else
  28.         print("message not received!")
  29.         sleep (1)
  30.     end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement