View difference between Paste ID: 6bw75b9U and ivgUsCZn
SHOW: | | - or go back to the newest paste.
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("-2,1,-1")
15+
	tank1Details = tank.getTargetDetails("1,1,-2")
16-
	filltank1 = tank1Details.Tanks[1].Amount
16+
	tankdroite = tank1Details.Tanks[1].Amount
17
	print(tankdroite)
18-
	tank2Details = tank.getTargetDetails("-2,1,1")
18+
	tank2Details = tank.getTargetDetails("-1,1,-2")
19-
	filltank2 = tank2Details.Tanks[1].Amount
19+
	tankgauche = tank2Details.Tanks[1].Amount
20
	print(tankgauche)
21-
	if filltank1 > uppertank and filltank2 > uppertank then
21+
22
	if tankdroite > uppertank and tankgauche > uppertank then
23
		redstone.setOutput("right", true)
24-
	 print("cas1")
24+
		print("Moteur droite OFF")
25-
	elseif filltank1 < lowertank and filltank2 > uppertank then
25+
26
		print("Moteur gauche OFF")
27
	elseif tankdroite < lowertank and tankgauche > uppertank then
28-
	 print("cas2")
28+
29-
	elseif filltank1 > uppertank and filltank2 < lowertank then
29+
		print("Moteur droite ON")
30
		redstone.setOutput("left", true)
31
		print("Moteur gauche OFF")
32-
	 print("cas3")
32+
	elseif tankdroite > uppertank and tankgauche < lowertank then
33-
	elseif filltank1 < lowertank and filltank2 < lowertank then
33+
34
		print("Moteur droite OFF")
35
		redstone.setOutput("left", false)
36-
  print("cas4")
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