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 vehicle using the Raspberry Pi Zero in Python


The first step to take advantage of the functionality is to install the library associated with the control board, which can be found at http://www.monkmakes.com/?page_id=698. You need to connect your Raspberry Pi Zero to the Internet with either a wired or WLAN connection. Issue the following commands in a terminal window on your Raspberry Pi Zero:

  1. Type wget https://github.com/simonmonk/raspirobotboard2/raw/master/python/dist/rrb2-1.1.tar.gz: This will download the library to your Raspberry Pi.

  2. Type tar -xzf rrb2-1.1.tar.gz: This unarchives the library.

  3. Type cd rrb2-1.1: This changes directory to the location of the files.

  4. Type sudo python setup.py install: This installs the libraries.

Now that you have the library code installed, you need to create some Python code that will allow you to access the two motors. The first part of the code should look as follows:

The second part of the code that drives the two different motors, based...