MicroPython MMC5983 Library¶
mmc5983
¶
MicroPython Library for the Memsic MMC5983 Magnetometer
Author(s): Jose D. Montoya
mmc5983
¶
MicroPython Library for the Memsic MMC5983 Magnetometer
Author(s): Jose D. Montoya
-
class micropython_mmc5983.mmc5983.MMC5983(i2c, address: int =
0x30
)[source]¶ Driver for the MMC5983 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
MMC5983
class. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C from micropython_mmc5983 import mmc5983
Once this is done you can define your
machine.I2C
object and define your sensor objecti2c = I2C(1, sda=Pin(2), scl=Pin(3)) mmc5983 = mmc5983.MMC5983(i2c)
Now you have access to the attributes
magx, magy, magz = mmc5983.magnetic
- property bandwidth : str¶
Sensor bandwidth. These bandwidth selection bits adjust the length of the decimation filter. They control the duration of each measurement
Mode
Value
mmc5983.BW_100HZ
0b00
mmc5983.BW_200HZ
0b01
mmc5983.BW_400HZ
0b10
mmc5983.BW_800HZ
0b11
- property continuous_mode_frequency : str¶
Sensor continuous_mode_frequency determine how often the chip will take measurements in Continuous Measurement Mode. The frequency is based on the assumption that
bandwidth
isBW_100HZ
Mode
Value
mmc5983.CM_OFF
0b000
mmc5983.CM_1HZ
0b001
mmc5983.CM_10HZ
0b010
mmc5983.CM_20HZ
0b011
mmc5983.CM_50HZ
0b100
mmc5983.CM_100HZ
0b101
mmc5983.CM_200HZ
0b110
mmc5983.CM_1000HZ
0b111
- property operation_mode : str¶
Sensor operation_mode. In order to enter the continuous mode,
continuous_mode_frequency
cannot beCM_OFF
Mode
Value
mmc5983.ONE_SHOT
0b0
mmc5983.CONTINUOUS
0b1