onevent prox 
    #Follower
    max = prox.horizontal[0]
    mi = 0
    speed_l=0
    for i in 0:4 do 
        if prox.horizontal[i]> max then
            max = prox.horizontal[i]
            mi = i
        end
    end

    t = 2 - mi
    speed_diff = t * (speed / 2)
    if max > 3500 then
        speed_l = (3500 - max) / 2
    end
    if (max > 4000) then
        speed_l = -speed 
    end
    if (max < 3000) then
        t = 300 - (max - 1000) / 7
        speed_l = t
    end

    if (max < 2000) then
        speed_l = speed 
    end

    if(speed_l > speed) then
        speed_l = speed
    end
    if(speed_l < -speed) then
        speed_l = -speed
    end

    if(max < DETECT) then
        motor.left.target = 0
        motor.right.target = 0
     else 
        motor.right.target = speed_diff + speed_l
        motor.left.target = speed_l - speed_diff
     end
    #Sound
    when(max > DETECT) do
        call sound.system(6)
    end

    if (speed_diff == 0 and speed_l == 0 and sound_done == 0 and max > DETECT) then
        sound_done = 1
        call sound.system(7)
    end
    if(speed_diff != 0 or max < DETECT) then
        sound_done = 0
    end