From 081f8f47b3cc22ca002fc46f55fbc8894c939f0e Mon Sep 17 00:00:00 2001 From: Cullen Newsom Date: Thu, 24 Sep 2015 08:53:46 -0500 Subject: [PATCH] Added constant to fix getRange and setRange bug Encountered an error attempting to use getRange() error follows: AttributeError: 'Adafruit_ADXL345' object has no attribute 'ADXL345_REG_DATA_FORMAT' Adding the constant fixes getRange and setRange bug add print accel.getRange() to the example code to reporduce --- Adafruit_ADXL345/Adafruit_ADXL345.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Adafruit_ADXL345/Adafruit_ADXL345.py b/Adafruit_ADXL345/Adafruit_ADXL345.py index 50b00abe..57bff8b0 100755 --- a/Adafruit_ADXL345/Adafruit_ADXL345.py +++ b/Adafruit_ADXL345/Adafruit_ADXL345.py @@ -34,6 +34,7 @@ class Adafruit_ADXL345(Adafruit_I2C): ADXL345_REG_DEVID = 0x00 # Device ID ADXL345_REG_DATAX0 = 0x32 # X-axis data 0 (6 bytes for X/Y/Z) ADXL345_REG_POWER_CTL = 0x2D # Power-saving features control + ADXL345_REG_DATA_FORMAT = 0x31 # getRange setRange ADXL345_DATARATE_0_10_HZ = 0x00 ADXL345_DATARATE_0_20_HZ = 0x01