Advertisement
Batword

Test n°1

Aug 2nd, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2.  
  3. tank = sensor.wrap("top")
  4.  
  5. uppertank = 235000
  6. lowertank = 5000
  7.  
  8. while true do
  9.     tank1Details = tank.getTargetDetails("-2,1,-1")
  10.     filltank1 = tank1Details["Amount"]
  11.     tank2Details = tank.getTargetDetails("-2,1,1")
  12.     filltank2 = tank2Details["Amount"]
  13.    
  14.     if filltank1 > uppertank and filltank2 > uppertank then
  15.         redstone.setOutput("right", true)
  16.         redstone.setOutput("left", true)
  17.    
  18.     elseif filltank1 < lowertank and filltank2 > uppertank then
  19.         redstone.setOutput("right", false)
  20.         redstone.setOutput("left", true)
  21.    
  22.     elseif filltank1 > uppertank and filltank2 < lowertank then
  23.         redstone.setOutput("right", true)
  24.         redstone.setOutput("left", false)
  25.    
  26.     elseif filltank1 < lowertank and filltank2 < lowertank then
  27.         redstone.setOutput("right", false)
  28.         redstone.setOutput("left", false)
  29.     end
  30.    
  31. sleep(3)
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement