'----------------------------------------------------------------------------- 'estop.bs2 -- Aaron Richardson -- Arrick Robotics -- 2/4/99 ' www.robotics.com ' 'This routine demonstrates how to use an emergency stop button. The idea behind the estop button is to have a button that stops the robot before it can fall down stairs, into the fireplace, or run over the cat. charn var byte 'get chars from coprocessor. red con 10 net con 8 'coprocessor network pin. baud con 396 'coprocessor network baud rate. speaker con 9 'speaker pin. low speaker 'turn off speaker. main gosub motor1 'start motor. main1 'start of main loop. if in12 = 0 then estop 'check estop button. goto main1 'end of main loop. '------------------------------------------------------------------ 'signal that the estop button has been pushed. ' estop gosub stopmtr gosub honk 'honk a couple of times. gosub honk gosub honk gosub honk gosub honk estop1 low red 'flash red led and honk. gosub honk pause 500 high red pause 500 goto estop1 '------------------------------------------------------------------ 'turn motor 1 on. ' motor1 'drive motor. serout net,baud,["!1M111FFFF"] 'mtr 1,fwd,spd,dis. serin net,baud,[charn] 'get acknowledge char. if charn<>"A" then motor1 'keep trying if no good. return '------------------------------------------------------------------ 'turn motor 1 on. ' stopmtr 'drive motor. serout net,baud,["!1M110FFFF"] 'mtr 1,fwd,spd,dis. serin net,baud,[charn] 'get acknowledge char. if charn<>"A" then motor1 'keep trying if no good. return '------------------------------------------------------------------ 'beep beep honk honk. ' honk freqout speaker,200,1500 low speaker return