Guest User

Untitled

a guest
May 17th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. #5
  2. function reset()
  3.   port.d = false
  4.   port.c = false
  5.   port.a = false
  6.  
  7.   interrupt(0.01, "play")
  8. end
  9.  
  10. function play()
  11.   t = mem.msg
  12.   if(t ~= nil) then
  13.      for i=1, #t do
  14.        if(t[i] == 65) then
  15.             port.d = not port.d
  16.        elseif(t[i] == 66) then
  17.             port.c = not port.c
  18.        elseif(t[i] == 67) then
  19.             port.a = not port.a
  20.        end
  21.      end
  22.   end
  23.   mem.msg = {}
  24. end
  25.  
  26. if(event.type == "digiline" and event.channel == "ch_ABC") then
  27.   mem.msg = event.msg
  28.   reset()  
  29. elseif(event.iid == "play") then
  30.   play()
  31. end
Add Comment
Please, Sign In to add comment