### STEERING PART ###
    intensityDiff = prox.ground.delta[1]-525
    #speed of robot is adjusted to keep around a gray mean value. If             difference is too important, the robot spins until it finds the line         again. The steering is controled by the gray gradient of the trail.
    if abs(intensityDiff) < 170 then
        motor.left.target = 115+intensityDiff/8
        motor.right.target = 115-intensityDiff/8
    else
        motor.left.target = intensityDiff/4
        motor.right.target = -intensityDiff/4
#edit to stop colours if line is lost
        state = S_WAIT_SYNC
    end