Page 151 - The Ultimate Palm Robot
P. 151
Color profile: Generic CMYK printer profile
Composite Default screen
Bots / The Ultimate Palm Robot/ Mukhar & Johnson / 222880-6 / Chapter 6
134 The Ultimate Palm Robot
enter a type that is not supported by the language, the program you create will
not work.
If you are using the PRP to write a TEA program, you can use one of five
kinds of variables: char, unsigned char, int, unsigned int, and string. Here’s
what they mean:
❏ char Any value from –128 to 127
❏ unsigned char Any value from 0 to 255
❏ int Any value from –32768 to 32767
❏ unsigned int Any value from 0 to 65535
❏ string A fixed series of characters
If you are writing a program for Java, you can use any legal Java data types.
However, we recommend you limit yourself to the following:
❏ char Any value from –128 to 127
❏ int Any value from –32768 to 32767 (Java ints can actually
have larger magnitudes, but to ensure compatibility with the
BrainStem, you should limit ints to the values shown)
❏ String A fixed series of characters
Finally, limit your Basic programs to these three data types:
❏ char Any value from –128 to 127
❏ int Any value from –32768 to 32767
❏ String A fixed series of characters
The Constant Component Constants are like variables, except that they
usually do not change within a program. Properties for this component are
name, type, and value, and these properties have the same meaning as they do
for variables. Why would you use a constant? Well, imagine that you are
writing a program that reads data from Sensor 0. All through your code you
use the number 0. You know that this number is being used to refer to Sensor 0.
The problem is that someone reading your program doesn’t know what that 0
P:\010Comp\Bots\880-6\ch06.vp
Monday, May 12, 2003 1:06:23 PM