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
MMC5983class. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C from micropython_mmc5983 import mmc5983Once this is done you can define your
machine.I2Cobject and define your sensor objecti2c = I2C(1, sda=Pin(2), scl=Pin(3)) mmc5983 = mmc5983.MMC5983(i2c)Now you have access to the attributes
- 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_100HZ0b00mmc5983.BW_200HZ0b01mmc5983.BW_400HZ0b10mmc5983.BW_800HZ0b11
- 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
bandwidthisBW_100HZMode
Value
mmc5983.CM_OFF0b000mmc5983.CM_1HZ0b001mmc5983.CM_10HZ0b010mmc5983.CM_20HZ0b011mmc5983.CM_50HZ0b100mmc5983.CM_100HZ0b101mmc5983.CM_200HZ0b110mmc5983.CM_1000HZ0b111
- property operation_mode : str¶
Sensor operation_mode. In order to enter the continuous mode,
continuous_mode_frequencycannot beCM_OFFMode
Value
mmc5983.ONE_SHOT0b0mmc5983.CONTINUOUS0b1