Book Image

Raspberry Pi Embedded Projects Hotshot

Book Image

Raspberry Pi Embedded Projects Hotshot

Overview of this book

Table of Contents (20 chapters)
Raspberry Pi Mechatronics Projects HOTSHOT
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Interfacing game inputs using the PiFace module


In this task, we will review interfacing the arcade style buttons (shown in the following image) to Raspberry Pi to play the game. In this task, we will just discuss the software part of the code.

Momentary arcade pushbutton switch (http://na.suzohapp.com/all_catalogs/pushbuttons/58-9111-L)

We will make use of the PiFace interface board available at http://www.piface.org.uk/products/piface_digital/ to interface these buttons to Raspberry Pi. The board is a stackable add-on hardware that can be used to interface eight inputs and eight outputs. The PiFace comes with four tactile switches and we can get started with testing the inputs.

The main reason behind using the PiFace is that we need to monitor the switch states to determine there is a key press. The PiFace comes with an I/O expansion option and can be accessed through the SPI interface. These features enable simple control of the game inputs.

Prepare for lift off

  1. Raspberry Pi's Serial Peripheral...