local sensor=peripheral.find("sensor")
local ouvert=false
rs.setOutput("top",false)
os.sleep(0.4)
rs.setOutput("right",true)

while true do
	liste=sensor.getTargets()
	yaquelquun=false
	table.foreach(liste,function(id,data)
		if data.IsPlayer==true then
			yaquelquun=true
		end
	end)
	
	if yaquelquun==true then
  print("Joueur")
		if ouvert==false then
			rs.setOutput("right",false)
			os.sleep(0.4)
			rs.setOutput("top",true)
			ouvert=true
		end
		os.sleep(3)
	else
		--print("Personne")
		if ouvert==true then
			rs.setOutput("top",false)
			os.sleep(0.4)
			rs.setOutput("right",true)
			ouvert=false
		end
		os.sleep(0.5)
		
	end
	
	
end
