diff --git a/adafruit_lis3dh/lis3dh.py b/adafruit_lis3dh/lis3dh.py index 91b037f..3b8531c 100755 --- a/adafruit_lis3dh/lis3dh.py +++ b/adafruit_lis3dh/lis3dh.py @@ -3,7 +3,10 @@ # https://github.com/adafruit/Adafruit_LIS3DH/ # Author: Tony DiCola # License: MIT License (https://en.wikipedia.org/wiki/MIT_License) -import ustruct +try: + import struct +except: + import ustruct as struct from micropython import const @@ -96,9 +99,9 @@ def acceleration(self): a 3-tuple and are in m / s ^ 2. """ data = self._read_register(REG_OUT_X_L | 0x80, 6) - x = ustruct.unpack(' 3: raise ValueError('ADC must be a value 1 to 3!') data = self._read_register((REG_OUTADC1_L+((adc-1)*2)) | 0x80, 2) - return ustruct.unpack('