Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Getting Started with Raspberry Pi Zero

You're reading from  Getting Started with Raspberry Pi Zero

Product type Book
Published in Mar 2016
Publisher
ISBN-13 9781786469465
Pages 228 pages
Edition 1st Edition
Languages
Author (1):
Richard Grimmett Richard Grimmett
Profile icon Richard Grimmett

Table of Contents (16) Chapters

Getting Started with Raspberry Pi Zero
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Getting Started with Raspberry Pi Zero 2. Programming Raspberry Pi Zero 3. Accessing the GPIO Pins on Raspberry Pi Zero 4. Building and Controlling a Simple Wheeled Robot 5. Building a Robot That Can Walk 6. Adding Voice Recognition and Speech – A Voice Activated Robot 7. Adding Raspberry Pi Zero to an RC Vehicle 8. Playing Rock, Paper, or Scissors with Raspberry Pi Zero 9. Adding Raspberry Pi Zero to a Quadcopter 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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}