Page 116 - The Ultimate Palm Robot
P. 116

Color profile: Generic CMYK printer profile
           Composite  Default screen
                                                          Bots /The Ultimate Palm Robot/ Mukhar & Johnson / 222880-6 / Chapter 5






                                                                  Chapter 5  Checking Out the Robot   99



                                      On this screen, three programs are written in the BASIC programming lan-
                                    guage for HotPaw Basic, and one C language program is written for PocketC.
                                    The three BASIC programs are sequence_motors_test.bas, triangle3.bas, and
                                    square2.bas. As you might guess, these programs test the servos, move the
                                    robot in a triangle pattern, and move the robot in a square pattern. The C
                                    Program is PocketPPRK and it demonstrates a number of different features of
                                    the robot.

                         Using a BASIC Program with the Robot
                                    Let’s use one of the BASIC programs to test out the PPRK. Before you can do
                                    that, though, you’ll need to get a BASIC interpreter for your PDA. After
                                    you’ve loaded an interpreter to the PDA, you can load and run BASIC pro-
                                    grams on your PDA. So let’s start with the interpreter.

                                    Loading HotPaw Basic
                                    Several BASIC interpreters are available for the Palm OS. The three programs
                                    on the Community Programs page were written for HotPaw Basic. We’ve in-
                                    cluded a copy of this application on the CD-ROM to make it easy for you to get
                                    started. Find the ybas138b0.zip file in the \Other Applications\HotPaw di-
                                    rectory of the CD-ROM and unpack it to your PC. You need to load two files to
                                    your PDA: ybasic.prc and mathlib.prc.

                                      The Robot Geek Says

                                      Basic and Palm OS Devices
                                       ✖   Even though we used HotPaw Basic to run the sample program here,
                                           you can write programs for your robot using any BASIC interpreter that
                                           runs on a Palm OS device. In addition to HotPaw Basic, we’ve included
                                           NS Basic on the CD-ROM.
                                       ✖   For now, you don’t need to worry about how to write a BASIC program
                                           or how it executes. If you’re really interested, we cover that topic in
                                           Chapter 7.
                                      HotPaw Basic looks for program files in the Palm’s Memo Pad. Program
                                   filenames begin with a pound (#) sign, are followed by the name of the pro-
                                   gram, and end with a .bas extension. Here’s how to prepare your PDA to run
                                   the program:

                                        ❏ Download the triangle3.bas program (available at www-2.cs
                                           .cmu.edu/~pprk/programs.html or on the CD-ROM.)
                                        ❏ Open triangle3.bas in a text editor and copy it into a memo in
                                           the Palm Desktop on your PC. If you synchronize with Microsoft





           P:\010Comp\Bots\880-6\ch05.vp
           Monday, May 12, 2003 4:06:09 PM
   111   112   113   114   115   116   117   118   119   120   121