clean up comments
This commit is contained in:
parent
d1fcc8aabd
commit
663419a7e0
3 changed files with 11 additions and 5 deletions
|
|
@ -105,7 +105,7 @@ Usage Example
|
||||||
while True:
|
while True:
|
||||||
mag_x, mag_y, mag_z = sensor.magnetic
|
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("")
|
print("")
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,11 @@ _LSB_PER_GAUSS = {RANGE_30G: 1000.0, RANGE_12G: 2500.0, RANGE_8G: 3750.0, RANGE_
|
||||||
|
|
||||||
|
|
||||||
class QMC5883P:
|
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
|
# Register definitions using adafruit_register
|
||||||
_chip_id = ROUnaryStruct(_CHIPID, "<B")
|
_chip_id = ROUnaryStruct(_CHIPID, "<B")
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,14 @@ import board
|
||||||
|
|
||||||
import adafruit_qmc5883p
|
import adafruit_qmc5883p
|
||||||
|
|
||||||
i2c = board.I2C() # uses board.SCL and board.SDA
|
i2c = board.I2C()
|
||||||
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
|
# i2c = board.STEMMA_I2C()
|
||||||
|
|
||||||
sensor = adafruit_qmc5883p.QMC5883P(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.mode = adafruit_qmc5883p.MODE_CONTINUOUS
|
||||||
# sensor.data_rate = adafruit_qmc5883p.ODR_10HZ
|
# sensor.data_rate = adafruit_qmc5883p.ODR_10HZ
|
||||||
# sensor.range = adafruit_qmc5883p.RANGE_2G
|
# sensor.range = adafruit_qmc5883p.RANGE_2G
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue