Download Print this page

Parallax Boe-Bot Whisker Kit Instructions page 3

Advertisement

BASIC Stamp Boe-Bot Navigation Using Whiskers
Whiskers.bs2 is a simple roaming program example that uses Whiskers instead of infrared for object detection.
This program listing makes the Boe-Bot travel straight ahead while monitoring the whiskers to see if they have
bumped into an obstacle. As soon as an obstacle is detected, the Boe-Bot backs up, turns, and continues forward
until another obstacle is encountered.
When a whisker is pressed, due to an obstacle, the normally open switch closes. When this happens, the output
signal goes from high to low. I/O pins P10 and P5 are set to input and used to monitor the states of these switches.
The two whiskers may be in one of four states:
(1) Both high – no objects detected
(2) Left low, right high – object detected on the left, turn right.
(3) Right low, left high – object detected on the right, turn left.
(4) Both low – indicates a head-on collision with a wide object such as a wall.
' Whiskers.bs2 - Simple program for detecting objects
' with a BASIC Stamp II in a Boe-Bot
' Constant and Variable Definitions
'-----------------------------------------------------------------------------------
servo_left
servo_right
whisker_left
whisker_right
counter
' Main Program
'-----------------------------------------------------------------------------------
check_whiskers:
if whisker_left = 0 and whisker_right = 0 then back
if whisker_left = 0 then right
if whisker_right = 0 then left
drive_servos:
pulsout servo_left,850
pulsout servo_right,650
pause 10
goto check_whiskers
back:
for counter = 0 to 100
pulsout servo_left,650
pulsout servo_right,850
next
return
goto drive_servos
left:
gosub back
for counter = 0 to 50
pulsout servo_left,650
pulsout servo_right,650
next
goto drive_servos
con
15
con
14
var
in10
var
in5
var
word
Whisker Kit Instructions (June 2000) • Page
' left servo on P15
' right servo on P15
' left whisker on P10
' right whisker on P5
' loop counter variable
' check each whisker
' drive forward
' backwards if both switches close
' turn left if right switch closes
Parallax, Inc
http://www.parallaxinc.com
http://www.stampsinclass.com
3

Advertisement

loading
Need help?

Need help?

Do you have a question about the Boe-Bot Whisker Kit and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

28134