thanks lefty..hers what i want to do....maybe i am saying it wrong...ok here is a PBASIC program
'BS2 Robot Demo
'By oldELECTROguy
'Shows How To Use BS2 For Robotic Use
'Cyles Servos and Bumper Switches
'----------------------------- Constants --------------------------------------------
dirs=%11111111 ' Make all I/O Pins Output
Mstop Con 150 ' Brake Servo
MfFor Con 200 ' Run Servo Foward Fast
MsFor Con 160 ' Run Servo Forward Slow
MfRev Con 80 ' Run Servo Reverse Fast
MsRev Con 140 ' Run Servo Reverse Slow
VOn Con 2 ' Enable Talk (For Talk Chip - ISD1110P
VOff Con 3 ' Disable Talk
SDelay Con 15 ' 10 millisecond delay for Servo
'------------------------------Variables----------------------------------------------
RBump Var Bit 'Sensor 1=OK 0=Touched Something
LBump Var Bit 'Bit = 0 to 1
X Var Byte 'X = 0 to 255
Y Var Nib 'Y = 0 to 15
Z Var Word 'Z = 0 to 65535
'-------------------------------MAIN LOOP---------------------------------------------
again:
gosub forward
gosub Fslow
gosub Back
gosub BackS
gosub Brake
gosub Soundme
goto again
'------------------------------SUB ROUTINES-------------------------------------------
forward:
debug "Forward",cr
for x=1 to 200
pulsout 0,mffor
pulsout 1,mffor
pause sdelay
next
return
Fslow:
debug "Forward Slow",cr
for x=1 to 200
pulsout 0,msfor
pulsout 1,msfor
pause sdelay
next
return
Back:
debug "Reverse",cr
for x=1 to 200
pulsout 0,mfrev
pulsout 1,mfrev
pause sdelay
next
return
BackS:
debug "Reverse Slow",cr
for x=1 to 200
pulsout 0,msrev
pulsout 1,msrev
pause sdelay
next
return
Brake:
debug "Brake",cr
for z=1 to 1000
pulsout 0,mStop
pulsout 1,mStop
pause sdelay
next
return
SOUNDME:
debug "Danger Will Robinson",cr
freqout 7,1500,1000,1200
pause 5
freqout 7,1000,1200,1800
pause 5
return