' Smart Sensors and Applications - TestPingDirection.bs2 ' Point the Ping))) 0-degrees (to the right), then 180-degrees (to the right), ' then straight ahead. ' {$STAMP BS2} ' {$PBASIC 2.5} PingServo PIN 14 ' Servo directs Ping))) LimitLeft CON 1250 ' Ping servo 90-degrees left LimitRight CON 300 ' Ping servo 90-degrees right Center CON 750 ' Center/0-degree pulse duration BtwnPulses CON 20 ' ms between servo pulses counter VAR Byte ' Loop index DEBUG "Look to 0-degrees (right).", CR FOR counter = 1 TO 100 ' 100 pulses 0-degrees (right) PULSOUT 14, LimitRight PAUSE 20 NEXT DEBUG "Look to 180-degrees (left).", CR FOR counter = 1 TO 100 ' 100 pulses 180-degrees (left) PULSOUT 14, LimitLeft PAUSE 20 NEXT DEBUG "Look to 90-degrees (straight ahead).", CR FOR counter = 1 TO 100 ' 100 pulses 90-degrees (ahead) PULSOUT 14, Center PAUSE 20 NEXT END