Skip to content

Arduino library for the Bosch BMM150 magnetometer used in Arduino Nano 33 BLE Sense

License

Notifications You must be signed in to change notification settings

AndreGrue/Arduino_BOSCH_BMM150

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino_BOSCH_BMM150

This is an Arduino library for the BOSCH BMM150 magnetometer like it is used in the Arduino Nano 33 BLE Sense. The library supports several ways of reading the sensor data,

This library uses the BOSCH BMM150 Sensor API.

Data sheets

Usage

Object creation

#include "bosch_bmm150.h"
andrgrue::sensor::bosch_bmm150 Mag(Wire1);

float mag_x, mag_y, mag_z;
andrgrue::sensor::bosch_bmm150::Data mag_data;

Setup

void setup() {

  // wire must be initialized first
  Wire1.begin();
  Wire1.setClock(400000);

  if(!Mag.initialize(BMM150_DATA_RATE_25HZ)) {
    Serial.println("MAG init failed!");
    while (1);
  }

  Serial.print("sample rate: mag=");
  Serial.println(Mag.magneticfieldSampleRate());
}

Loop

void loop() {

  if(Mag.magneticfieldAvailable()){
    Mag.magneticfield(mag_data);
  }

}

Credits

This project was inspired and includes several elements from the following projects. Special thanks to the authors.

License

Copyright © 2024, André Grüttner. All rights reserved.

This project is licensed under the GNU Lesser General Public License v2.1 (LGPL-2.1). You may use, modify, and distribute this software under the terms of the LGPL-2.1 license. See the LICENSE file for details, or visit GNU’s official LGPL-2.1 page for the full license text.

About

Arduino library for the Bosch BMM150 magnetometer used in Arduino Nano 33 BLE Sense

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published