emagiannu

PneumaticCraft Pressure Control

Jun 9th, 2014
706
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --DjGiannuzz PneumaticCraft PressureControl Computer
  2.  
  3. local tArgs = {...}
  4. pr  = tArgs[1]
  5. inSide = tArgs[2]
  6. outSide = tArgs[3]
  7.  
  8. function getRedstone(i)
  9.   return 2*i
  10. end
  11.  
  12. function getPressure(i)
  13.   return i/2
  14. end
  15.  
  16. rs = getRedstone(pr)
  17. print("Detecting Analog Redstone Signal level: " .. rs)
  18. print("Input side: " .. inSide)
  19. print("Output side: " .. outSide)
  20. print("Giving redstone signal at: " .. pr .. "bar")
  21. print()
  22.  
  23. while true do
  24. x = redstone.getAnalogInput(inSide)
  25. print("Actual pressure: " .. getPressure(x))
  26.  
  27. if x >= rs then
  28.   redstone.setOutput(outSide, false)
  29.   redstone.setBundledOutput(outSide, 0)
  30. else
  31.   redstone.setOutput(outSide, true)
  32.   redstone.setBundledOutput(outSide, 1)
  33. end
  34.  
  35. sleep(0.5)
  36. end
Advertisement
Add Comment
Please, Sign In to add comment