28125 Parallax Inc, 28125 Datasheet - Page 228

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
Constants can even be used to calculate other constants. Here is an example of two
constants, named
four constants just discussed. The
used in the program to figure out whether or not the flashlight beam has been detected.
'
LeftThreshold
RightThreshold CON
The math performed on these constants is an average, and then a scale. The average
calculation for
multiplied by 5 and divided by 8. This means that
value is the
Example Program: FlashlightControlledBoeBot.bs2
Enter FlashlightControlledBoeBot.bs2 into the BASIC Stamp Editor.
Substitute your
1) in place of the value 108 in the
Math expressions in PBASIC are executed from left to right. First,
added to
divided by 8.
Let’s try this:
You can use parentheses to force a calculation that is further to the right in a line of
PBASIC code to be completed first. For example, you can rewrite this line of PBASIC
code:
In this expression, 35 is multiplied by the result of (
product is added to 750.
like this:
5
/
pulseRight = 35 * (2 – distanceRight) + 750
8
pulseRight = 2 - distanceRight * 35 + 750
of the average of
LeftThreshold
LeftThreshold
LeftAmbient
CON
128 / 2 = 64.
64 * 5 = 320
320 / 8 = 40
LeftBright
timeLeft
LeftBright + LeftAmbient / 2
RightBright + RightAmbient / 2 * 5 / 8
Average
LeftBright
. This value is divided by 2. The result is then multiplied by 5 and
is
measurement with no flashlight beam (from Table 6-
+
LeftThreshold
and
LeftBright
LeftAmbient
RightThreshold
LeftAmbient CON
and
LeftAmbient
+
= 20 + 108 = 128.
LeftThreshold
and
LeftAmbient
2 – distanceRigh
RightThreshold
that are calculated using the
directive.
.
Scale factor
* 5 / 8
/ 2. That result is
is a constant whose
LeftBright
constants are
t), then the
is

Related parts for 28125