Guest User

pressure

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