clean up comments

This commit is contained in:
Liz 2025-08-08 13:46:33 -04:00
parent d1fcc8aabd
commit 663419a7e0
3 changed files with 11 additions and 5 deletions

View file

@ -105,7 +105,7 @@ Usage Example
while True:
mag_x, mag_y, mag_z = sensor.magnetic
print(f"X:{mag_x:10.2f}, Y:{mag_y:10.2f}, Z:{mag_z:10.2f} uT")
print(f"X:{mag_x:2.3f}, Y:{mag_y:2.3f}, Z:{mag_z:2.3f} G")
print("")
time.sleep(1)

View file

@ -100,7 +100,11 @@ _LSB_PER_GAUSS = {RANGE_30G: 1000.0, RANGE_12G: 2500.0, RANGE_8G: 3750.0, RANGE_
class QMC5883P:
"""Driver for the QMC5883P 3-axis magnetometer."""
"""Driver for the QMC5883P 3-axis magnetometer.
:param ~busio.I2C i2c_bus: The I2C bus the QMC5883P is connected to.
:param int address: The I2C address of the device. Defaults to :const:`0x3C`
"""
# Register definitions using adafruit_register
_chip_id = ROUnaryStruct(_CHIPID, "<B")

View file

@ -10,12 +10,14 @@ import board
import adafruit_qmc5883p
i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
i2c = board.I2C()
# i2c = board.STEMMA_I2C()
sensor = adafruit_qmc5883p.QMC5883P(i2c)
# Optional: Configure sensor settings
# configure sensor settings
# defaults to MODE_NORMAL, ODR_50HZ, RANGE_8G
# sensor.mode = adafruit_qmc5883p.MODE_CONTINUOUS
# sensor.data_rate = adafruit_qmc5883p.ODR_10HZ
# sensor.range = adafruit_qmc5883p.RANGE_2G