onevent prox # if a sensor measures a value less than 300, it does not see the table if prox.ground.delta[0]<300 or prox.ground.delta[1]<300 then # stop the motors motor.left.target=0 motor.right.target=0 # switch on a red light on the robot to signal an emergency stop call leds.top(32, 0, 0) else # if we do not see the edge of the table, switch off the red light call leds.top(0, 0, 0) end