From 56ec690aa829218d00a90207916debddc35c90ca Mon Sep 17 00:00:00 2001 From: siddacious Date: Tue, 14 Jan 2020 13:51:04 -0800 Subject: [PATCH 1/6] refactoring to support ISM330DHCT --- README.rst | 4 +- adafruit_lsm6dsox.py => adafruit_lsm6ds.py | 206 ++++++++++++--------- docs/api.rst | 2 +- docs/conf.py | 2 +- examples/ism330dhct_simpletest.py | 14 ++ examples/lsm6ds33_simpletest.py | 14 ++ examples/lsm6dsox_full_test.py | 2 +- examples/lsm6dsox_rate_test.py | 16 +- examples/lsm6dsox_simpletest.py | 8 +- setup.py | 2 +- 10 files changed, 166 insertions(+), 104 deletions(-) rename adafruit_lsm6dsox.py => adafruit_lsm6ds.py (66%) create mode 100644 examples/ism330dhct_simpletest.py create mode 100644 examples/lsm6ds33_simpletest.py diff --git a/README.rst b/README.rst index 3315a7c..08f18de 100644 --- a/README.rst +++ b/README.rst @@ -61,11 +61,11 @@ Usage Example import time import board import busio - import adafruit_lsm6dsox + import adafruit_lsm6ds i2c = busio.I2C(board.SCL, board.SDA) - sox = adafruit_lsm6dsox.LSM6DSOX(i2c) + sox = adafruit_lsm6ds.LSM6DSOX(i2c) while True: print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2"%(sox.acceleration)) diff --git a/adafruit_lsm6dsox.py b/adafruit_lsm6ds.py similarity index 66% rename from adafruit_lsm6dsox.py rename to adafruit_lsm6ds.py index 6322401..2d911df 100644 --- a/adafruit_lsm6dsox.py +++ b/adafruit_lsm6ds.py @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. """ -`adafruit_lsm6dsox` +`adafruit_lsm6ds` ================================================================================ CircuitPython library for the ST LSM6DSOX 6-axis Accelerometer and Gyro @@ -58,35 +58,36 @@ __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LSM6DSOX.git" -_LSM6DSOX_DEFAULT_ADDRESS = const(0x6a) -_LSM6DSOX_CHIP_ID = const(0x6C) -_ISM330DHCX_CHIP_ID = const(0x6B) - - -_LSM6DSOX_FUNC_CFG_ACCESS = const(0x1) -_LSM6DSOX_PIN_CTRL = const(0x2) -_LSM6DSOX_UI_INT_OIS = const(0x6F) -_LSM6DSOX_WHOAMI = const(0xF) -_LSM6DSOX_CTRL1_XL = const(0x10) -_LSM6DSOX_CTRL2_G = const(0x11) -_LSM6DSOX_CTRL3_C = const(0x12) -_LSM6DSOX_CTRL_5_C = const(0x14) -_LSM6DSOX_MASTER_CONFIG = const(0x14) -_LSM6DSOX_CTRL9_XL = const(0x18) -_LSM6DSOX_OUT_TEMP_L = const(0x20) -_LSM6DSOX_OUT_TEMP_H = const(0x21) -_LSM6DSOX_OUTX_L_G = const(0x22) -_LSM6DSOX_OUTX_H_G = const(0x23) -_LSM6DSOX_OUTY_L_G = const(0x24) -_LSM6DSOX_OUTY_H_G = const(0x25) -_LSM6DSOX_OUTZ_L_G = const(0x26) -_LSM6DSOX_OUTZ_H_G = const(0x27) -_LSM6DSOX_OUTX_L_A = const(0x28) -_LSM6DSOX_OUTX_H_A = const(0x29) -_LSM6DSOX_OUTY_L_A = const(0x2A) -_LSM6DSOX_OUTY_H_A = const(0x2B) -_LSM6DSOX_OUTZ_L_A = const(0x2C) -_LSM6DSOX_OUTZ_H_A = const(0x2D) +_LSM6DS_DEFAULT_ADDRESS = const(0x6a) + +_LSM6DS_CHIP_ID = const(0x6C) +_ISM330DHCT_CHIP_ID = const(0x6B) +_LSM6DS33_CHIP_ID = const(0x69) + +_LSM6DS_FUNC_CFG_ACCESS = const(0x1) +_LSM6DS_PIN_CTRL = const(0x2) +_LSM6DS_UI_INT_OIS = const(0x6F) +_LSM6DS_WHOAMI = const(0xF) +_LSM6DS_CTRL1_XL = const(0x10) +_LSM6DS_CTRL2_G = const(0x11) +_LSM6DS_CTRL3_C = const(0x12) +_LSM6DS_CTRL_5_C = const(0x14) +_LSM6DS_MASTER_CONFIG = const(0x14) +_LSM6DS_CTRL9_XL = const(0x18) +_LSM6DS_OUT_TEMP_L = const(0x20) +_LSM6DS_OUT_TEMP_H = const(0x21) +_LSM6DS_OUTX_L_G = const(0x22) +_LSM6DS_OUTX_H_G = const(0x23) +_LSM6DS_OUTY_L_G = const(0x24) +_LSM6DS_OUTY_H_G = const(0x25) +_LSM6DS_OUTZ_L_G = const(0x26) +_LSM6DS_OUTZ_H_G = const(0x27) +_LSM6DS_OUTX_L_A = const(0x28) +_LSM6DS_OUTX_H_A = const(0x29) +_LSM6DS_OUTY_L_A = const(0x2A) +_LSM6DS_OUTY_H_A = const(0x2B) +_LSM6DS_OUTZ_L_A = const(0x2C) +_LSM6DS_OUTZ_H_A = const(0x2D) _MILLI_G_TO_ACCEL = 0.00980665 @@ -153,7 +154,8 @@ class Rate(CV): ('RATE_1_6_HZ', 11, 1.6, None) )) -class LSM6DSOX: #pylint: disable=too-many-instance-attributes + +class LSM6DS: #pylint: disable=too-many-instance-attributes """Driver for the LSM6DSOX 6-axis accelerometer and gyroscope. @@ -163,59 +165,61 @@ class LSM6DSOX: #pylint: disable=too-many-instance-attributes """ #ROUnaryStructs: - _chip_id = ROUnaryStruct(_LSM6DSOX_WHOAMI, " Date: Tue, 14 Jan 2020 16:15:05 -0800 Subject: [PATCH 2/6] moved uncommon code into subclasses --- adafruit_lsm6ds.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/adafruit_lsm6ds.py b/adafruit_lsm6ds.py index 2d911df..7f869e6 100644 --- a/adafruit_lsm6ds.py +++ b/adafruit_lsm6ds.py @@ -189,7 +189,6 @@ class LSM6DS: #pylint: disable=too-many-instance-attributes _gyro_range_4000dps = RWBit(_LSM6DS_CTRL2_G, 0) _sw_reset = RWBit(_LSM6DS_CTRL3_C, 0) - _if_inc = RWBit(_LSM6DS_CTRL3_C, 2) _sim = RWBit(_LSM6DS_CTRL3_C, 3) _pp_od = RWBit(_LSM6DS_CTRL3_C, 4) _h_lactive = RWBit(_LSM6DS_CTRL3_C, 5) @@ -223,18 +222,16 @@ def __init__(self, i2c_bus, address=_LSM6DS_DEFAULT_ADDRESS): self.reset() self._bdu = True - self._i3c_disable = True - self._if_inc = True - self._accel_data_rate = Rate.RATE_104_HZ #pylint: disable=no-member - self._gyro_data_rate = Rate.RATE_104_HZ #pylint: disable=no-member + self.accel_data_rate = Rate.RATE_104_HZ #pylint: disable=no-member + self.gyro_data_rate = Rate.RATE_104_HZ #pylint: disable=no-member + + self.accel_range = AccelRange.RANGE_4G #pylint: disable=no-member + self.gyro_range = GyroRange.RANGE_250_DPS #pylint: disable=no-member - self._accel_range = AccelRange.RANGE_4G #pylint: disable=no-member self._cached_accel_range = self._accel_range - self._gyro_range = GyroRange.RANGE_250_DPS #pylint: disable=no-member self._cached_gyro_range = self._gyro_range - def reset(self): "Resets the sensor's configuration into an initial state" self._sw_reset = True @@ -244,12 +241,6 @@ def reset(self): while self._boot: sleep(0.001) - @property - def is_lsm6dsox(self): - """Returns `True` if the connected sensor is an LSM6DSOX, - `False` if not, it's an ICM330DHCT""" - return self._chip_id is _LSM6DS_CHIP_ID - @property def acceleration(self): """The x, y, z acceleration values returned in a 3-tuple and are in m / s ^ 2.""" @@ -358,6 +349,9 @@ class LSM6DSOX(LSM6DS): #pylint: disable=too-many-instance-attributes """ CHIP_ID = _LSM6DS_CHIP_ID + def __init__(self, i2c_bus, address=_LSM6DS_DEFAULT_ADDRESS): + super().__init__(i2c_bus, address) + self._i3c_disable = True class LSM6DS33(LSM6DS): #pylint: disable=too-many-instance-attributes @@ -378,3 +372,8 @@ class ISM330DHCT(LSM6DS): #pylint: disable=too-many-instance-attributes """ CHIP_ID = _ISM330DHCT_CHIP_ID + def __init__(self, i2c_bus, address=_LSM6DS_DEFAULT_ADDRESS): + super().__init__(i2c_bus, address) + + # Called DEVICE_CONF in the datasheet, but it recommends setting it + self._i3c_disable = True From 32f72e7a81cfeb00516b488364b09a97bcd84bad Mon Sep 17 00:00:00 2001 From: siddacious Date: Tue, 14 Jan 2020 17:14:01 -0800 Subject: [PATCH 3/6] fixed data rate issue and gyro range issue --- adafruit_lsm6ds.py | 6 +++--- examples/lsm6ds_full_test.py | 29 +++++++++++++++++++++++++++++ examples/lsm6dsox_full_test.py | 22 ---------------------- 3 files changed, 32 insertions(+), 25 deletions(-) create mode 100644 examples/lsm6ds_full_test.py delete mode 100644 examples/lsm6dsox_full_test.py diff --git a/adafruit_lsm6ds.py b/adafruit_lsm6ds.py index 7f869e6..d5b9d03 100644 --- a/adafruit_lsm6ds.py +++ b/adafruit_lsm6ds.py @@ -223,10 +223,10 @@ def __init__(self, i2c_bus, address=_LSM6DS_DEFAULT_ADDRESS): self._bdu = True - self.accel_data_rate = Rate.RATE_104_HZ #pylint: disable=no-member + self.accelerometer_data_rate = Rate.RATE_104_HZ #pylint: disable=no-member self.gyro_data_rate = Rate.RATE_104_HZ #pylint: disable=no-member - self.accel_range = AccelRange.RANGE_4G #pylint: disable=no-member + self.accelerometer_range = AccelRange.RANGE_4G #pylint: disable=no-member self.gyro_range = GyroRange.RANGE_250_DPS #pylint: disable=no-member self._cached_accel_range = self._accel_range @@ -304,7 +304,7 @@ def gyro_range(self, value): self._gyro_range_4000dps = True else: self._gyro_range_125dps = False - self._gyro_range_4000dps = True + self._gyro_range_4000dps = False self._gyro_range = value self._cached_gyro_range = value diff --git a/examples/lsm6ds_full_test.py b/examples/lsm6ds_full_test.py new file mode 100644 index 0000000..492a32e --- /dev/null +++ b/examples/lsm6ds_full_test.py @@ -0,0 +1,29 @@ +import time +import board +import busio +from adafruit_lsm6ds import LSM6DS33, LSM6DSOX, ISM330DHCT, Rate, AccelRange, GyroRange +#pylint:disable=no-member + +i2c = busio.I2C(board.SCL, board.SDA) + +sensor = LSM6DS33(i2c) +#sensor = LSM6DSOX(i2c) +#sensor = ISM330DHCT(i2c) + +sensor.accelerometer_range = AccelRange.RANGE_8G +print("Accelerometer range set to: %d G"%AccelRange.string[sensor.accelerometer_range]) + +sensor.gyro_range = GyroRange.RANGE_2000_DPS +print("Gyro range set to: %d DPS"%GyroRange.string[sensor.gyro_range]) + +sensor.accelerometer_data_rate = Rate.RATE_1_66K_HZ +#sensor.accelerometer_data_rate = Rate.RATE_12_5_HZ +print("Accelerometer rate set to: %d HZ"%Rate.string[sensor.accelerometer_data_rate]) + +sensor.gyro_data_rate = Rate.RATE_1_66K_HZ +print("Gyro rate set to: %d HZ"%Rate.string[sensor.gyro_data_rate]) + +while True: + print("Accel X:%.2f Y:%.2f Z:%.2f ms^2 Gyro X:%.2f Y:%.2f Z:%.2f degrees/s"% + (sensor.acceleration+sensor.gyro)) + time.sleep(0.05) diff --git a/examples/lsm6dsox_full_test.py b/examples/lsm6dsox_full_test.py deleted file mode 100644 index 7b26d8f..0000000 --- a/examples/lsm6dsox_full_test.py +++ /dev/null @@ -1,22 +0,0 @@ -import board -import busio -from adafruit_lsm6ds import LSM6DSOX, Rate, AccelRange, GyroRange -#pylint:disable=no-member -i2c = busio.I2C(board.SCL, board.SDA) -sox = LSM6DSOX(i2c) - -sox.accelerometer_range = AccelRange.RANGE_16G -print("Accelerometer range set to: %d G"%AccelRange.string[sox.accelerometer_range]) - -sox.gyro_range = GyroRange.RANGE_500_DPS -print("Gyro range set to: %d DPS"%GyroRange.string[sox.gyro_range]) - -sox.accelerometer_rate = Rate.RATE_12_5_HZ -print("Accelerometer rate set to: %d HZ"%Rate.string[sox.accelerometer_rate]) - -sox.gyro_rate = Rate.RATE_12_5_HZ -print("Gyro rate set to: %d HZ"%Rate.string[sox.gyro_rate]) - -while True: - print("Accel X:%.2f Y:%.2f Z:%.2f ms^2 Gyro X:%.2f Y:%.2f Z:%.2f degrees/s"% - (sox.acceleration+sox.gyro)) From 746b19c523570e03b3c6dacb1490d64610b952f1 Mon Sep 17 00:00:00 2001 From: siddacious Date: Tue, 14 Jan 2020 19:03:34 -0800 Subject: [PATCH 4/6] updated examples --- examples/lsm6ds_full_test.py | 2 +- examples/lsm6ds_rate_test.py | 29 +++++++++++++++++++++++++++++ examples/lsm6dsox_rate_test.py | 27 --------------------------- 3 files changed, 30 insertions(+), 28 deletions(-) create mode 100644 examples/lsm6ds_rate_test.py delete mode 100644 examples/lsm6dsox_rate_test.py diff --git a/examples/lsm6ds_full_test.py b/examples/lsm6ds_full_test.py index 492a32e..576772e 100644 --- a/examples/lsm6ds_full_test.py +++ b/examples/lsm6ds_full_test.py @@ -1,8 +1,8 @@ import time import board import busio +#pylint:disable=no-member,unused-import from adafruit_lsm6ds import LSM6DS33, LSM6DSOX, ISM330DHCT, Rate, AccelRange, GyroRange -#pylint:disable=no-member i2c = busio.I2C(board.SCL, board.SDA) diff --git a/examples/lsm6ds_rate_test.py b/examples/lsm6ds_rate_test.py new file mode 100644 index 0000000..ad2eb6a --- /dev/null +++ b/examples/lsm6ds_rate_test.py @@ -0,0 +1,29 @@ +import board +import busio +#pylint:disable=no-member,unused-import +from adafruit_lsm6ds import LSM6DS33, LSM6DSOX, ISM330DHCT, Rate + +i2c = busio.I2C(board.SCL, board.SDA) + +sensor = LSM6DS33(i2c) +#sensor = LSM6DSOX(i2c) +#sensor = ISM330DHCT(i2c) + +while True: + sensor.accelerometer_data_rate = Rate.RATE_12_5_HZ + sensor.gyro_data_rate = Rate.RATE_12_5_HZ + for i in range(100): + print("(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f"%(sensor.acceleration+sensor.gyro)) + print() + + sensor.accelerometer_data_rate = Rate.RATE_52_HZ + sensor.gyro_data_rate = Rate.RATE_52_HZ + for i in range(100): + print("(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f"%(sensor.acceleration+sensor.gyro)) + print() + + sensor.accelerometer_data_rate = Rate.RATE_416_HZ + sensor.gyro_data_rate = Rate.RATE_416_HZ + for i in range(100): + print("(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f"%(sensor.acceleration+sensor.gyro)) + print() diff --git a/examples/lsm6dsox_rate_test.py b/examples/lsm6dsox_rate_test.py deleted file mode 100644 index 59e4f1e..0000000 --- a/examples/lsm6dsox_rate_test.py +++ /dev/null @@ -1,27 +0,0 @@ -import board -import busio -import adafruit_lsm6ds -#pylint:disable=no-member - -i2c = busio.I2C(board.SCL, board.SDA) - -sox = adafruit_lsm6ds.LSM6DSOX(i2c) - -while True: - sox.accelerometer_data_rate = adafruit_lsm6ds.Rate.RATE_12_5_HZ - sox.gyro_data_rate = adafruit_lsm6ds.Rate.RATE_12_5_HZ - for i in range(100): - print("(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f"%(sox.acceleration+sox.gyro)) - print() - - sox.accelerometer_data_rate = adafruit_lsm6ds.Rate.RATE_52_HZ - sox.gyro_data_rate = adafruit_lsm6ds.Rate.RATE_52_HZ - for i in range(100): - print("(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f"%(sox.acceleration+sox.gyro)) - print() - - sox.accelerometer_data_rate = adafruit_lsm6ds.Rate.RATE_416_HZ - sox.gyro_data_rate = adafruit_lsm6ds.Rate.RATE_416_HZ - for i in range(100): - print("(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f"%(sox.acceleration+sox.gyro)) - print() From 58d7cb4171c9a5707abadf4e20b0bbfa70a4c09b Mon Sep 17 00:00:00 2001 From: siddacious Date: Tue, 14 Jan 2020 19:46:09 -0800 Subject: [PATCH 5/6] fixing formatted strings --- examples/ism330dhct_simpletest.py | 4 ++-- examples/lsm6ds33_simpletest.py | 4 ++-- examples/lsm6ds_full_test.py | 10 +++++----- examples/lsm6ds_rate_test.py | 6 +++--- examples/lsm6dsox_simpletest.py | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/ism330dhct_simpletest.py b/examples/ism330dhct_simpletest.py index e675a59..e6a99ec 100644 --- a/examples/ism330dhct_simpletest.py +++ b/examples/ism330dhct_simpletest.py @@ -8,7 +8,7 @@ sensor = ISM330DHCT(i2c) while True: - print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2"%(sensor.acceleration)) - print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s"%(sensor.gyro)) + print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration)) + print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro)) print("") time.sleep(0.5) diff --git a/examples/lsm6ds33_simpletest.py b/examples/lsm6ds33_simpletest.py index b0ca517..ccb3e35 100644 --- a/examples/lsm6ds33_simpletest.py +++ b/examples/lsm6ds33_simpletest.py @@ -8,7 +8,7 @@ sensor = LSM6DS33(i2c) while True: - print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2"%(sensor.acceleration)) - print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s"%(sensor.gyro)) + print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration)) + print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro)) print("") time.sleep(0.5) diff --git a/examples/lsm6ds_full_test.py b/examples/lsm6ds_full_test.py index 576772e..47dffcf 100644 --- a/examples/lsm6ds_full_test.py +++ b/examples/lsm6ds_full_test.py @@ -11,19 +11,19 @@ #sensor = ISM330DHCT(i2c) sensor.accelerometer_range = AccelRange.RANGE_8G -print("Accelerometer range set to: %d G"%AccelRange.string[sensor.accelerometer_range]) +print("Accelerometer range set to: %d G" % AccelRange.string[sensor.accelerometer_range]) sensor.gyro_range = GyroRange.RANGE_2000_DPS -print("Gyro range set to: %d DPS"%GyroRange.string[sensor.gyro_range]) +print("Gyro range set to: %d DPS" % GyroRange.string[sensor.gyro_range]) sensor.accelerometer_data_rate = Rate.RATE_1_66K_HZ #sensor.accelerometer_data_rate = Rate.RATE_12_5_HZ -print("Accelerometer rate set to: %d HZ"%Rate.string[sensor.accelerometer_data_rate]) +print("Accelerometer rate set to: %d HZ" % Rate.string[sensor.accelerometer_data_rate]) sensor.gyro_data_rate = Rate.RATE_1_66K_HZ -print("Gyro rate set to: %d HZ"%Rate.string[sensor.gyro_data_rate]) +print("Gyro rate set to: %d HZ" % Rate.string[sensor.gyro_data_rate]) while True: - print("Accel X:%.2f Y:%.2f Z:%.2f ms^2 Gyro X:%.2f Y:%.2f Z:%.2f degrees/s"% + print("Accel X:%.2f Y:%.2f Z:%.2f ms^2 Gyro X:%.2f Y:%.2f Z:%.2f degrees/s" % (sensor.acceleration+sensor.gyro)) time.sleep(0.05) diff --git a/examples/lsm6ds_rate_test.py b/examples/lsm6ds_rate_test.py index ad2eb6a..5ba3574 100644 --- a/examples/lsm6ds_rate_test.py +++ b/examples/lsm6ds_rate_test.py @@ -13,17 +13,17 @@ sensor.accelerometer_data_rate = Rate.RATE_12_5_HZ sensor.gyro_data_rate = Rate.RATE_12_5_HZ for i in range(100): - print("(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f"%(sensor.acceleration+sensor.gyro)) + print("(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f" % (sensor.acceleration+sensor.gyro)) print() sensor.accelerometer_data_rate = Rate.RATE_52_HZ sensor.gyro_data_rate = Rate.RATE_52_HZ for i in range(100): - print("(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f"%(sensor.acceleration+sensor.gyro)) + print("(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f" % (sensor.acceleration+sensor.gyro)) print() sensor.accelerometer_data_rate = Rate.RATE_416_HZ sensor.gyro_data_rate = Rate.RATE_416_HZ for i in range(100): - print("(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f"%(sensor.acceleration+sensor.gyro)) + print("(%.2f, %.2f, %.2f, %.2f, %.2f, %.2f" % (sensor.acceleration+sensor.gyro)) print() diff --git a/examples/lsm6dsox_simpletest.py b/examples/lsm6dsox_simpletest.py index c95389d..b2355d5 100644 --- a/examples/lsm6dsox_simpletest.py +++ b/examples/lsm6dsox_simpletest.py @@ -8,7 +8,7 @@ sensor = LSM6DSOX(i2c) while True: - print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2"%(sensor.acceleration)) - print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s"%(sensor.gyro)) + print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration)) + print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro)) print("") time.sleep(0.5) From 116162e5665e62e1fe9b79744a02afdf87aef574 Mon Sep 17 00:00:00 2001 From: siddacious Date: Tue, 14 Jan 2020 20:00:13 -0800 Subject: [PATCH 6/6] changing cache init --- adafruit_lsm6ds.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adafruit_lsm6ds.py b/adafruit_lsm6ds.py index d5b9d03..813b98a 100644 --- a/adafruit_lsm6ds.py +++ b/adafruit_lsm6ds.py @@ -214,6 +214,9 @@ class LSM6DS: #pylint: disable=too-many-instance-attributes _raw_gyro_data = Struct(_LSM6DS_OUTX_L_G, "