' {$STAMP BS1} ' {$PBASIC 1.0} '------------------------------------------------------ ' Servo Random Movement Generator ' By Vern Graner April 26th, 2005 ' Any questions to vern@graner.com ' R-04.26a '------------------------------------------------------ 'SYMBOL I = B0 ' value can be 0 to 255 SYMBOL X = B1 ' value can be 0 to 255 'SYMBOL SERVO1 = B2 ' value can be 0 to 255 'SYMBOL SERVO2 = B3 ' value can be 0 to 255 'SYMBOL SERVO3 = B4 ' value can be 0 to 255 'SYMBOL SERVO4 = B5 ' value can be 0 to 255 SYMBOL result = W1 ' DEBUG "go!" Main: result = 11000 ' set initial "seed" value RANDOM result ' generate random number DEBUG result ' show the result on screen GOTO Main GOTO EXIT FOR X = 50 TO 200 STEP 2 ' DEBUG "X=", x, CR ' FOR I=0 TO 1 PULSOUT 0,x ' Send servo pulse. PULSOUT 1,x ' Send servo pulse. PULSOUT 2,x ' Send servo pulse. PULSOUT 3,x ' Send servo pulse. PAUSE 20 ' Wait 1/50th second. ' NEXT I NEXT X exit: DEBUG "Done!" END