adafruit_lis2mdl
CircuitPython driver for the LIS2MDL 3-axis magnetometer.
Author(s): Bryan Siepert
Hardware:
Adafruit Triple-axis Accelerometer+Magnetometer (Compass) Board - LSM303 (Product ID: 1120)
Adafruit FLORA Accelerometer/Compass Sensor - LSM303 - v1.0 (Product ID: 1247)
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
Data rate choices to set using data_rate
100 Hz
10 Hz
20 Hz
50 Hz
Driver for the LIS2MDL 3-axis magnetometer.
i2c (I2C) – The I2C bus the device is connected to
Quickstart: Importing and using the device
Here is an example of using the
LIS2MDL
class. First you will need to import the libraries to use the sensorimport board import adafruit_lis2mdlOnce this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA sensor = adafruit_lis2mdl.LIS2MDL(i2c)Now you have access to the
magnetic
attributemag_x, mag_y, mag_z = sensor.magnetic
The magnetometer update rate.
A tuple representing interrupts on each axis in a positive and negative direction (x_hi, y_hi, z_hi, x_low, y_low, z_low, int_triggered)
Enable or disable the magnetometer interrupt
The threshold (in microteslas) for magnetometer interrupt generation. Given value is compared against all axes in both the positive and negative direction
Enables and disables low power mode
The processed magnetometer sensor values. A 3-tuple of X, Y, Z axis values in microteslas that are signed floats.
Reset the sensor to the default state set by the library
An offset for the X-Axis to subtract from the measured value to correct for magnetic interference
An offset for the Y-Axis to subtract from the measured value to correct for magnetic interference
An offset for the Z-Axis to subtract from the measured value to correct for magnetic interference
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4