O'Reilly logo

Getting Started with Raspberry Pi Zero by Richard Grimmett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:
    Accessing the compass programmatically
  2. Then go to the A7 I2C selection and enable the I2C, as shown in the following screenshot:
    Accessing the compass programmatically
  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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required