Page 112 - Programming the Raspberry Pi Getting Started with Python
P. 112

NOTE   If you skipped Chapter 8 on pygame, now might be a good time to read through it.

             The program starts by importing the library modules it needs. It then creates an instance of the class
          RaspiRobot and assigns it to the variable rr. The main loop first checks for a QUIT event, and if it
          find one it exists the program. The rest of the loop is concerned with checking all of the keys and
          issuing the appropriate commands if a key is pressed. For  example,  if  the UP ARROW  key  (K_UP)  is
          pressed, the RaspiRobot is sent the command forward, which sets the motors to both go forward as
          well as sets both LEDs on.
          Phase 2: Adding a Range Finder and Screen
          When you complete Phase 2, your RaspiRobot will look like the one shown earlier in Figure  11-1.

          Disconnect the battery from the RaspiRobotBoard so that we can start making the necessary changes
          to complete this phase.
          Step 1: Assemble the Range Finder Serial Adapter
   107   108   109   110   111   112   113   114   115   116   117