Page 157 - Hacking Roomba
P. 157

138       Part II — Fun Things to Do




                             Or you can use a file explorer to drop the ZIP file into the libraries directory and double-click
                             it to unzip the contents.
                             When Processing is restarted, you should see roombacomm as a library choice when selecting
                             Sketch ➪ Import Library (see Figure 7-3).
































                             FIGURE 7-3: RoombaComm installed successfully as a Processing library


                             When you choose a library (like roombacomm) from Sketch ➪ Import Library, Processing
                             inserts the relevant Java import lines into the sketch. You don’t have to import libraries this
                             way, but it makes things easier if you don’t know the exact name of the classes in the library
                             you’re importing.

                             A First RoombaComm Processing Sketch

                             A good start might be the SimpleTest.java program seen before. Listing 7-3 shows a complete
                             Processing program to test Roomba. It’s a slightly abbreviated version of the regular SimpleTest
                             program, but it accomplishes the same purpose. With Listing 7-3 input into Processing, click
                             the Run button. Processing will compile and launch your sketch. If all’s well, the robot will
                             beep and move around. Your sketch will print out its messages to the black status panel below
                             your sketch. If there are errors, the errors will be in the status panel.
   152   153   154   155   156   157   158   159   160   161   162