Guest User

TestRec

a guest
Jan 20th, 2014
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. -- test
  2. -- 0.1
  3.  
  4. -- Wireless RedNet Test (reciever)
  5.  
  6. local senderID      = 0
  7. local startMessage  = "<<start>>"
  8. local isStarted     = false
  9. local modemSide     = "back"
  10.  
  11. function startup()
  12.     modem = peripheral.wrap(modemSide)
  13.     rednet.open(modemSide)
  14. end
  15.  
  16. function recieveMessage()
  17.     senderID,message = rednet.recieve()
  18.  
  19.     if message == startMessage then
  20.         isStarted = true
  21.     elseif not message == startMessage then
  22.         isStarted = false
  23.     end
  24.  
  25.     print("Message recieved...")
  26. end
  27.  
  28. function startThread()
  29.     if isStarted == true then
  30.         while isStarted == true do
  31.             rs.setOutput("right", true)
  32.             sleep(0.5)
  33.             rs.setOutput("right", false)
  34.         end
  35.     else
  36.         print("Invalid start code")
  37.     end
  38. end
Advertisement
Add Comment
Please, Sign In to add comment