28125 Parallax Inc, 28125 Datasheet - Page 197

TEXT ROBOTICS

28125

Manufacturer Part Number
28125
Description
TEXT ROBOTICS
Manufacturer
Parallax Inc
Datasheet

Specifications of 28125

Title
Robotics with the Boe-Bot
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
There is an example of nested
alternate whisker contacts in the next program.
Example Program: EscapingCorners.bs2
This program will cause your Boe-Bot to execute a U-turn at either the fourth or fifth
alternate corner, depending on which whisker was pressed first.
' -----[ Title ]--------------------------------------------------------------
' Robotics with the Boe-Bot - EscapingCorners.bs2
' Boe-Bot navigates out of corners by detecting alternating whisker presses.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
' -----[ Variables ]----------------------------------------------------------
pulseCount
counter
old7
old5
' -----[ Initialization ]-----------------------------------------------------
FREQOUT 4, 2000, 3000
counter = 1
old7 = 0
old5 = 1
' -----[ Main Routine ]-------------------------------------------------------
ENDIF
Enter, save, and run EscapingCorners.bs2.
Test this program by pressing alternate whiskers as the Boe-Bot roams.
Depending on which Whisker you started with, the Boe-Bot should execute its
U-Turn maneuver after either the fourth or fifth consecutive whisker press.
ELSE
ENDIF
ELSE
Commands for both condition2 and condition1
Commands for condition1 but not condition2
Commands for not condition1
VAR
VAR
VAR
VAR
Byte
Nib
Bit
Bit
IF…THEN
statements in the routine that detects consecutive
' Stamp directive.
' PBASIC directive.
' FOR...NEXT loop counter.
' Counts alternate contacts.
' Stores previous IN7.
' Stores previous IN5.
' Signal program start/reset.
' Start alternate corner count.
' Make up old values.

Related parts for 28125