MicroPython BMM150 Library¶
bmm150¶
MicroPython Driver for the Bosch BMM150 Magnetometer
Author(s): Jose D. Montoya
- class micropython_bmm150.bmm150.AlertStatus(high_x, high_y, high_z, low_x, low_y, low_z)¶
Create new instance of AlertStatus(high_x, high_y, high_z, low_x, low_y, low_z)
- high_x¶
Alias for field number 0
- high_y¶
Alias for field number 1
- high_z¶
Alias for field number 2
- low_x¶
Alias for field number 3
- low_y¶
Alias for field number 4
- low_z¶
Alias for field number 5
-
class micropython_bmm150.bmm150.BMM150(i2c, address: int =
0x13)[source]¶ Driver for the BMM150 Sensor connected over I2C.
- Parameters:¶
- Raises:¶
RuntimeError – if the sensor is not found
Quickstart: Importing and using the device
Here is an example of using the
BMM150class. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C from micropython_bmm150 import bmm150Once this is done you can define your
machine.I2Cobject and define your sensor objecti2c = I2C(1, sda=Pin(2), scl=Pin(3)) bmm150 = bmm150.BMM150(i2c)Now you have access to the attributes
- property data_rate : str¶
Sensor data_rate
Mode
Value
bmm150.RATE_10HZ0b000bmm150.RATE_2HZ0b001bmm150.RATE_6HZ0b010bmm150.RATE_8HZ0b011bmm150.RATE_15HZ0b100bmm150.RATE_20HZ0b101bmm150.RATE_25HZ0b110bmm150.RATE_30HZ0b111
- property interrupt_mode : str¶
Sensor interrupt_mode
Mode
Value
bmm150.INT_DISABLED0x00bmm150.INT_ENABLED0xFF
- property measurements : tuple[float, float, float, float]¶
Return Magnetometer data and hall resistance. This is Raw data. There are some code exposed from bosch in their github to adjust this data, however this is not exposed in the datasheet.
- property operation_mode : str¶
Sensor operation_mode
Mode
Value
bmm150.NORMAL0b00bmm150.FORCED0b01bmm150.SLEEP0b11
- property status_interrupt¶
Interrupt Status.