This is a breakout for the Adafruit MLX90393 magnetometer sensor breakout.
- Author(s): ktown
- Adafruit MLX90393 Magnetometer Sensor Breakout Board (Product ID: 4022)
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
- Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
MLX90393(i2c_bus, address=12, gain=7, resolution=0, filt=7, oversampling=3, debug=False)¶
Driver for the MLX90393 magnetometer.
Quickstart: Importing and using the device
Here is an example of using the
MLX90393class. First you will need to import the libraries to use the sensor
import board import adafruit_mlx90393
Once this is done you can define your
board.I2Cobject and define your sensor object
i2c = board.I2C() # uses board.SCL and board.SDA SENSOR = adafruit_mlx90393.MLX90393(i2c)
Now you have access to the
MX, MY, MZ = SENSOR.magnetic
Prints out the content of the last status byte in a human-readable format.
The filter level.
The gain setting for the device.
The last status byte received from the sensor.
The processed magnetometer sensor values. A 3-tuple of X, Y, Z axis values in microteslas that are signed floats.
The oversampling level.
Reads a single X/Y/Z sample from the magnetometer.
Gets the current value of the specified register.
Performs a software reset of the sensor.
The X axis resolution.
The Y axis resolution.
The Z axis resolution.
Writes the 16-bit value to the supplied register.