28125 Parallax Inc, 28125 Datasheet - Page 86

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
The “=” sign in
to do math with variables. Here are a couple of multiplication examples:
Example Program: VariablesAndSimpleMath.bs2
This program demonstrates how to declare, initialize, and perform operations on
variables.
' Robotics with the Boe-Bot - VariablesAndSimpleMath.bs2
' Declare variables and use them to solve a few arithmetic problems.
' {$STAMP BS2}
' {$PBASIC 2.5}
value
anotherValue
value = 500
anotherValue = 2000
DEBUG ? value
DEBUG ? anotherValue
value = 10 * anotherValue
DEBUG ? value
DEBUG ? anotherValue
END
How VariablesAndSimpleMath.bs2 Works
This code declares two word variables,
value = 10 * value
anotherValue = 2 * value
Before running the program, predict what each
Enter, save, and run VariablesAndSimpleMath.bs2.
Compare the results to your predictions and explain any differences.
value
Default Value - If you do not initialize a variable, the program will automatically start by
storing the number zero in that variable. That’s called the variable's default value.
value = 500
VAR
VAR
Word
Word
VAR
is an example of an operator. You can use other operators
Word
value
and
anotherValue
' Declare variables
' Declare variables
' Initialize variables
' Display values
' Perform operations
' Display values again
DEBUG
command will display.
.

Related parts for 28125