Page 210 - Hacking Roomba
P. 210

Chapter 10 — Using Roomba as an Input Device                  191











                                              status
                                                power


                                                 clean

                                                 spot

                                                max

                                               dirt
                                              detect
















                             FIGURE 10-1: Roomba movements, right turns shown


                             Listing 10-1 shows the heart of RoombaSketch, a Processing sketch that turns Roomba into a
                             mouse input for a vector drawing program. It has the following features:

                                 The distance and angle sensors become a virtual mouse pointer.
                                 The left and right bump sensors increment or decrement the drawing pen size.
                                 The Spot button becomes the main mouse button for starting or stopping drawing.
                                 The Clean button resets the cursor position to center of screen.
                                 The Power button quits the program.
                                 It draws a Roomba icon to show where the cursor is and how it’s oriented.
   205   206   207   208   209   210   211   212   213   214   215