Book Image

Getting Started with Raspberry Pi Zero

By : Richard Grimmett
Book Image

Getting Started with Raspberry Pi Zero

By: Richard Grimmett

Overview of this book

Raspberry Pi Zero is half the size of Raspberry Pi A, only with twice the utility. At just three centimeters wide, it packs in every utility required for full-fledged computing tasks. This practical tutorial will help you quickly get up and running with Raspberry Pi Zero to control hardware and software and write simple programs and games. You will learn to build creative programs and exciting games with little or no programming experience. We cover all the features of Raspberry Pi Zero as you discover how to configure software and hardware, and control external devices. You will find out how to navigate your way in Raspbian, write simple Python scripts, and create simple DIY programs.
Table of Contents (16 chapters)
Getting Started with Raspberry Pi Zero
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Controlling the RC car in Python


The hardware is ready, now you can access all this functionality from Raspberry Pi Zero. First, install the library associated with the control board, found at http://www.monkmakes.com/?page_id=698 and perform the following steps:

  1. Run the command wget https://github.com/simonmonk/raspirobotboard2/raw/master/python/dist/rrb2-1.1.tar.gz. This will retrieve the library.

  2. Then, run tar -xzf rrb2-1.1.tar.gz. This will unarchive the files.

  3. Type cd rrb2-1.1. This will change the directory to the location of the files.

  4. Type sudo python setup.py install. This will install the files.

Now you'll create some Python code that will allow you to access both the drive motor and the steering motor. The code will look similar to the following screenshot:

The specifics on the code are as follows:

  • import RPi.GPIO as GPIO: This will import the RPi.GPIO library, allowing you to send out a PWM signal to the front steering mechanism.

  • import time: This will import the time library, allowing...