The MagPi Issue 27

Page 4

CHOOSE YOUR WEAPON Adding console game controllers

Connecting an XBOX360, PS3 or Wiimote controller to a Raspberry Pi SKILL LEVEL : INTERMEDIATE Choose your Weapon It is possible, and lots of fun, to use a variety of today's modern console controllers for your Raspberry Pi projects. They are quite easy to install, readily available and you get quite a bit of kit for your buck! This article describes how to setup a Raspberry Pi to use a Microsoft® XBOX 360 gamepad (wired and wireless), a Sony® PS3 gamepad and Nintendo® Wiimote. For wireless devices you will need either the XBOX gamepad wireless adapter, or for the Wiimote and PS3 gamepad you can use an expensive bluetooth dongle. See http://www. elinux.org/RPi_USB_Bluetooth_adapters for a list of known working bluetooth dongles. I have tested all the code on a Raspberry Pi Model B, as well as on the new Model B+ board. Before installing any of the software ensure you are using a recent version of Raspbian and have updated your system. At the command line enter: sudo apt-get update sudo apt-get upgrade

To test all of the hardware, an easy piece of software to use on the Raspberry Pi is j stestgtk and the standard j oysti ck library.

4

Mark Routledge Guest Writer

Enter the following command to install the software: sudo apt-get i nstal l j stest-gtk j oysti ck

This program should now show up in your desktop ready for you to test. You will find the link under Menu → Other → j oysti ck testi ng and confi gurati on tool . Once installed it should display your hardware for example: Connecting your hardware. A brief note about using the bluetooth adapter. I have found these can be a little tempremental at times, so I strong recommend connecting your dongle directly to the Raspberry Pi and connect any other hardware via a powered USB hub, e.g. the excellent Raspberry Pi Hub! The bluetooth dongle will work from a powered hub on a low level, but the bluetooth stack may not be able to see it.

Setting up the XBOX gamepad First open up LXTerminal and install the required driver for the XBOX 360 gamepad. The same driver is used for both the wired gamepad and wireless gamepad, using the adapter. Enter: sudo apt-get i nstal l xboxdrv


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.