CS110:Lab10

From IPRE Wiki
Revision as of 19:42, 9 November 2009 by Ttthomas (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Lab 10: The Gamepad

Objective

  • Explore the different functions of the game pad

Using Your Game Pad to Drive Your Robot Around

In lab 02, you saw how you could use your game pad to control your robot's movements. You should ensure that your game pad is plugged into a USB port before starting IDLE. The annotated image below shows a game pad similar to the one you will be using.

Gamepad1.JPG

To use the game pad, type the following at the prompt:

gamepad()

You should see the following options when you do this:

        Pad   Action
     ------   -------
 Left/Right   turnLeft() and turnRight()
    Up/Down   forward() and backward()

     Button   Action
     ------   -------
          1   stop()
          2   takePicture()
          3   beep(.25, 523)
          4   beep(.25, 587)
          5   beep(.25, 659)
          6   speak('Hello. My name is Dribbler.')
          7   speak('Ouch! I'm a sensitive robot.')
          8   speak('I'm hungry. Do you have any batteries?')

Gamepad is now running... Press button 1 to stop.

You can then use the buttons on your game pad to move your robot around as well as to explore additional features of your robot (e.g. taking a picture, beeping or speaking).