def __init__(self, address=ADXL345_ADDRESS, i2c=None, **kwargs):
        """Initialize the ADXL345 accelerometer using its I2C interface.
        """
        # Setup I2C interface for the device.
        if i2c is None:
            import Adafruit_GPIO.I2C as I2C
            i2c = I2C
        self._device = i2c.get_i2c_device(address, **kwargs)
        # Check that the acclerometer is connected, then enable it.
        if self._device.readU8(ADXL345_REG_DEVID) == 0xE5:
            self._device.write8(ADXL345_REG_POWER_CTL, 0x08)
        else:
            raise RuntimeError('Failed to find the expected device ID register value, check your wiring.')
def __init__ ( self , address = ADXL345_ADDRESS , i2c = None , ** kwargs ) : if i2c is None : import Adafruit_GPIO . I2C as I2C i2c = I2C self . _device = i2c . get_i2c_device ( address , ** kwargs ) if self . _device . readU8 ( ADXL345_REG_DEVID ) == 0xE5 : self . _device . write8 ( ADXL345_REG_POWER_CTL , 0x08 ) else : raise RuntimeError ( 'Failed to find the expected device ID register value, check your wiring.' )
Initialize the ADXL345 accelerometer using its I2C interface.