100 REM Sweep in one direction
103 e = 100 : REM Forward duration
105 d = 40 : REM Turn & reverse duration
107 v = 75 : REM Velocity
110 FOR i = 700 TO 2300 STEP 200
120 SRVPING = i
130 PAUSE 100
150 NEXT i
210 FOR i = 1900 TO 1100 STEP -200
220 SRVPING = i
230 PAUSE 100
240 GOSUB 500
250 NEXT i
260 GOTO 100
500 REM Use PING to check environment
510 PING
520 p = PING : IF p = 0 THEN GOTO 520
525 PRINT "Distance ";p;" Position ";i;
530 IF p > 1200 THEN GOTO 900
540 IF i > 1500 THEN GOTO 800
550 IF i < 1500 THEN GOTO 700
600 REM Back up
605 PRINT " Back up"
610 SRVLEFT [d] = 1500 - v
620 SRVRIGHT [d] = 1500 + v
630 RETURN
700 REM Go to the left
705 PRINT " Go to left"
710 SRVLEFT [d] = 1500 - v
720 SRVRIGHT [d] = 1500 - v
730 RETURN
800 REM Go to the right
805 PRINT " Go to right"
810 SRVLEFT [d] = 1500 + v
820 SRVRIGHT [d] = 1500 + v
830 RETURN
900 REM Go forward
905 PRINT " Go forward"
910 SRVLEFT [e] = 1500 + v
920 SRVRIGHT [e] = 1500 - v
930 RETURN
