RavenSH4

NCReactorControl

Sep 26th, 2021 (edited)
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. inputSide = "bottom"
  2. outputSide = "right"
  3. rs.setOutput(outputSide, false)
  4. IsEnable = false
  5.  
  6. --
  7. function Update()
  8. --something
  9. signal = rs.getAnalogInput(inputSide)
  10. if IsEnable then
  11. --Reactor is enabled
  12. if signal >= 14 then
  13. IsEnable = false
  14. end
  15. else
  16. --Reactor is disabled
  17. if signal < 7 then
  18. IsEnable = true
  19. end
  20. end
  21.  
  22. rs.setOutput(outputSide, IsEnable)
  23. end
  24.  
  25.  
  26. --initialize
  27. Update()
  28. --Loop
  29. repeat
  30. local myTimer = os.startTimer(1)
  31.  
  32. event, p1, p2, p3 = os.pullEvent()
  33. if event == "timer" then
  34. Update()
  35. end
  36. until event == "char" and p1==("q")
Add Comment
Please, Sign In to add comment