28125 Parallax Inc, 28125 Datasheet - Page 192
28125
Manufacturer Part Number
28125
Description
TEXT ROBOTICS
Manufacturer
Parallax Inc
Datasheet
1.28125.pdf
(360 pages)
Specifications of 28125
Title
Robotics with the Boe-Bot
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
- Current page: 192 of 360
- Download datasheet (5Mb)
Programming the Boe-Bot to Navigate Based on Whisker Inputs
This next program makes the Boe-Bot go forward until it encounters an obstacle. In this
case, the Boe-Bot knows when it encounters an obstacle by bumping into it with one or
both of its whiskers. As soon as the obstacle is detected by the whiskers, the navigation
routines and subroutines developed in Chapter 4 will make the Boe-Bot back up and turn.
Then, the Boe-Bot resumes forward motion until it bumps into another obstacle.
In order to do that, the Boe-Bot needs to be programmed to make decisions. PBASIC has
a command called an
statements is:
The “…” means you can place a code block (one or more commands) between the
keywords. The next example program makes decisions based on the whisker inputs, and
then calls subroutines to make the Boe-Bot take action. The subroutines are similar to the
ones you developed in Chapter 4. Here is how
Example Program: RoamingWithWhiskers.bs2
This program demonstrates one way of evaluating the whisker inputs and deciding which
navigation subroutine to call using
√
√
IF (condition) THEN…{ELSEIF (condition)}…{ELSE}…ENDIF
IF (IN5
ELSEIF (IN5
ELSEIF (IN7
ELSE
ENDIF
Reconnect power to your board and servos.
Enter, save, and run RoamingWithWhiskers.bs2.
GOSUB Back_Up
GOSUB Turn_Left
GOSUB Turn_Left
GOSUB Back_Up
GOSUB Turn_Right
GOSUB Back_Up
GOSUB Turn_Left
GOSUB Forward_Pulse
= 0) AND (IN7 = 0) THEN
IF…THEN
= 0) THEN
= 0) THEN
statement that makes decisions. The syntax for
IF…THEN
.
IF…THEN
' Both whiskers detect obstacle,
' back up & U-turn (left twice)
' Left whisker contacts
' Back up & turn right
' Right whisker contacts
' Back up & turn left
' Both whiskers 1, no contacts
' Apply a forward pulse &
' check again
is used.
IF…THEN
Related parts for 28125
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
Part Number:
Description:
Microcontroller Modules & Accessories DISCONTINUED BY PARALLAX
Manufacturer:
Parallax Inc
Part Number:
Description:
BOOK UNDERSTANDING SIGNALS
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
COMPETITION RING FOR SUMOBOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
TEXT INFRARED REMOTE FOR BOE-BOT
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BOARD EXPERIMENT+LCD NX-1000
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
CONTROLLER 16SERVO MOTOR CONTROL
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
BASIC STAMP LOGIC ANALYZER
Manufacturer:
Parallax Inc
Datasheet:
Part Number:
Description:
IC MCU 2K FLASH 50MHZ SO-18
Manufacturer:
Parallax Inc
Datasheet: