Example Code for Raspberry Pi-get configuration status

Last revision 2026/01/21

Get the configuration status of the BMM150 sensor on Raspberry Pi.

Hardware Preparation

Software Preparation

Wiring Diagram

Connect the module with Raspberry Pi as shown below. Default address: 0x13.

Connection Raspberry Pi

Other Preparation Work

  1. Enable Raspberry Pi I2C:
    • Open the terminal and enter sudo raspi-config.
    • Select "5 Interface Options" -> "P5 I2C" -> "YES", then restart.
  2. Install dependencies:
    • sudo apt-get update
    • sudo apt-get install build-essential python-dev python-smbus git
  3. Download the library:
    • cd Desktop
    • git clone https://github.com/DFRobot/DFRobot_BMM150
  4. Navigate to the sample code directory:
    • cd DFRobot_BMM150/python/raspberrypi/examples/get_all_state

Sample Code

Open the terminal and enter the following commands to run the sample code:

cd DFRobot_BMM150/python/raspberrypi/examples
cd get_all_state
python get_all_state.py

Result

Sample 1

Was this article helpful?

TOP