Advertisement
Guest User

Control

a guest
Apr 8th, 2020
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. local component = require "component"
  2. local modem = component.modem
  3. local probe = component.ElnProbe
  4. local event = require "event"
  5. modem.open(1)
  6.  
  7. local function split(inputstr, sep)
  8.   if sep == nil then
  9.     sep = "%s"
  10.   end
  11.   local t={}
  12.   for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  13.     table.insert(t, str)
  14.   end
  15.   return t
  16. end
  17.  
  18. while true do
  19.   local _, _, _, _, _, message = event.pull("modem_message"); print(message)
  20.  
  21.   if message:match("TWMS ") then
  22.     local commands = split(message)
  23.  
  24.     probe.wirelessSet(message, 1)
  25.     os.sleep(0.2)
  26.     probe.wirelessSet(message, 0)
  27.   end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement