Page 138 - The Definitive Guide to Building Java Robots
P. 138
Preston_5564C04.fm Page 119 Wednesday, October 5, 2005 7:22 AM
CHAPTER 4 ■ SENSORS 119
Figure 4-10. A class diagram relationship to the Chapter 2 classes
I have also added methods that are more descriptive and take less parameters: getDinsmore(),
getDevantech(), and getVector().
Finally, in main(), I test this class by first displaying the heading from the default value,
CMD_DEVANTECH, and then CMD_VECTOR. Finally, I set the compass using its setter,
setCompass(), and then get the compass reading via getHeading(). (See Example 4-2.)