Book Image

Raspberry Pi cookbook for Python programmers

Book Image

Raspberry Pi cookbook for Python programmers

Overview of this book

Table of Contents (18 chapters)
Raspberry Pi Cookbook for Python Programmers
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The GPIO keypad input


We have seen how we can monitor inputs on the GPIO to launch applications and control the Raspberry Pi; however, sometimes we need to control third-party programs. Using the uInput library, we can emulate key presses from a keyboard (or even mouse movement) to control any program using our own custom hardware.

For more information about using uInput, visit http://tjjr.fi/sw/python-uinput/.

Getting ready

Perform the following steps to install uInput:

  1. First we need to download uInput:

    You will need to download the uInput Python library from Github (~50 KB) using the following commands:

    wget https://github.com/tuomasjjrasanen/python-uinput/archive/master.zip
    unzip master.zip
    

    The library will unzip to a directory called python-uinput-master.

    Once completed, you can remove the ZIP file using the following command:

    rm master.zip
    
  2. Install the required packages (if you have installed them already, the apt-get command will ignore them) using the following commands:

    sudo apt-get install...