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

Accessing the compass programmatically


Now that the device is connected, you'll need to configure access via the software. Here are the steps:

  1. In order to access the compass capability, you'll need to enable the I2C library on Raspberry Pi Zero. To enable this bus, run sudo raspi-config and select 9 Advanced Options, as follows:

  2. Then go to the A7 I2C selection and enable the I2C, as shown in the following screenshot:

  3. Select Yes to enable the I2C interface, as shown in the following screenshot:

  4. Select OK on the next screen, then Yes on the screen that asks whether you want the I2C kernel module loaded by default, as shown:

  5. Select OK to return to the main selection, then exit and reboot your Raspberry Pi Zero.

Now you can sense whether the device is connected. Install the I2C toolkit by typing sudo apt-get install i2c-tools. You can see whether I2C is enabled by typing sudo i2cdetect -y 1 and then you should see something similar to the following screenshot:

You can see the device at 1e. Now you...