Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. local pulses = 0
  2.  
  3. function getPulses()
  4. while true do
  5. os.pullEvent 'redstone'
  6. if rs.getInput 'left' then
  7. pulses = pulses + 1
  8. repeat
  9. os.pullEvent 'redstone'
  10. until not rs.getInput 'left'
  11. pulses = 0
  12. end
  13. end
  14. end
  15.  
  16. function waitForKeyword()
  17. while true do
  18. local input = read()
  19. if input == 'send' then
  20. for i=1, pulses do
  21. rs.setInput('right', true)
  22. sleep(0.1)
  23. rs.setInput('right', false)
  24. end
  25. end
  26. end
  27. end
  28.  
  29. parallel.waitForAny(waitForKeyword, getPulses)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement