Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- tank = sensor.wrap("top")
- uppertank = 235000
- lowertank = 5000
- redstone.setOutput("right", true)
- print("Moteur droite OFF")
- redstone.setOutput("left", true)
- print("Moteur gauche OFF")
- while true do
- tank1Details = tank.getTargetDetails("1,1,-2")
- tankdroite = tank1Details.Tanks[1].Amount
- print(tankdroite)
- tank2Details = tank.getTargetDetails("-1,1,-2")
- tankgauche = tank2Details.Tanks[1].Amount
- print(tankgauche)
- if tankdroite > uppertank and tankgauche > uppertank then
- redstone.setOutput("right", true)
- print("Moteur droite OFF")
- redstone.setOutput("left", true)
- print("Moteur gauche OFF")
- elseif tankdroite < lowertank and tankgauche > uppertank then
- redstone.setOutput("right", false)
- print("Moteur droite ON")
- redstone.setOutput("left", true)
- print("Moteur gauche OFF")
- elseif tankdroite > uppertank and tankgauche < lowertank then
- redstone.setOutput("right", true)
- print("Moteur droite OFF")
- redstone.setOutput("left", false)
- print("Moteur gauche ON")
- elseif tankdroite < lowertank and tankgauche < lowertank then
- redstone.setOutput("right", false)
- print("Moteur droite OFF")
- redstone.setOutput("left", false)
- print("Moteur gauche ON")
- end
- sleep(3)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement