Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Raspberry Pi Robotic Projects - Third Edition

You're reading from  Raspberry Pi Robotic Projects - Third Edition

Product type Book
Published in Oct 2016
Publisher
ISBN-13 9781786467966
Pages 238 pages
Edition 3rd Edition
Languages
Concepts
Authors (2):
Richard Grimmett Richard Grimmett
Profile icon Richard Grimmett
Jon Witts Jon Witts
Profile icon Jon Witts
View More author details

Table of Contents (13) Chapters

Raspberry Pi Robotic Projects - Third Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Getting Started with the Raspberry Pi 2. Building Your Own Futuristic Robot 3. Building a Wall-E Robot 4. Building a Robotic Fish 5. Creating a Robotic Hand with the Raspberry Pi 6. A Self-Balancing Robot 7. Adding the Raspberry Pi to a Quadcopter

Accessing the compass programmatically


In order to access the compass capability you'll need to enable the I2C library on the Raspberry Pi. The first step to enable the IMU is to enable the I2C interface. The I2C interface is a synchronous serial interface, and provides more performance than an asynchronous Rx/Tx serial interface. The SCL data line provides a clock, while the data flows on the SDA line. The bus also provides addressing so that more than one device can be connected to the master device at the same time.

Enabling this bus is done by running sudo raspi-config, and selecting the Advanced Options, like this:

Once there, go to the I2C selection and enable the I2C, like this:

Say yes to all the selections to enable the I2C interface and load the library, then reboot the Raspberry Pi. Install the I2C tool kit by typing sudo apt-get install i2c-tools. You can see if the I2C is enabled by typing sudo i2cdetect -y 1, and you should see something like this:

You can see the device...

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 €14.99/month. Cancel anytime}