Advertisement
Batword

Prod jetfuel v2

Aug 5th, 2015
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("ocs/apis/sensor")
  2.  
  3. tank = sensor.wrap("top")
  4.  
  5. uppertank = 235000
  6. lowertank = 5000
  7.  
  8. redstone.setOutput("right", true)
  9. print("Moteur droite OFF")
  10. redstone.setOutput("left", true)
  11. print("Moteur gauche OFF")
  12.  
  13. while true do
  14.  
  15.     tank1Details = tank.getTargetDetails("1,1,-2")
  16.     tankdroite = tank1Details.Tanks[1].Amount
  17.     print(tankdroite)
  18.     tank2Details = tank.getTargetDetails("-1,1,-2")
  19.     tankgauche = tank2Details.Tanks[1].Amount
  20.     print(tankgauche)
  21.  
  22.     if tankdroite > uppertank and tankgauche > uppertank then
  23.         redstone.setOutput("right", true)
  24.         print("Moteur droite OFF")
  25.         redstone.setOutput("left", true)
  26.         print("Moteur gauche OFF")
  27.     elseif tankdroite < lowertank and tankgauche > uppertank then
  28.         redstone.setOutput("right", false)
  29.         print("Moteur droite ON")
  30.         redstone.setOutput("left", true)
  31.         print("Moteur gauche OFF")
  32.     elseif tankdroite > uppertank and tankgauche < lowertank then
  33.         redstone.setOutput("right", true)
  34.         print("Moteur droite OFF")
  35.         redstone.setOutput("left", false)
  36.         print("Moteur gauche ON")
  37.     elseif tankdroite < lowertank and tankgauche < lowertank then
  38.         redstone.setOutput("right", false)
  39.         print("Moteur droite OFF")
  40.         redstone.setOutput("left", false)
  41.         print("Moteur gauche ON")
  42.     end
  43.    
  44. sleep(3)
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement