Datasheet

Library Reference
Constructor:
Adafruit_ADXL345(int32_t sensorID = -1)
Constructs an instance of the ADXL345 device driver object. 'sensorID' is a device identifier.
It will be returned in the sensor_event in each call to getEvent(). The sensorID has no effect
on the operation of the driver or device, but is useful in managing sensor events in systems
with multiple sensors.
Initialization()
bool begin(void)
The begin() function initializes communication with the device. The return value is 'true' if it
succeeds in connecting to the ADXL345.
Sensor Details:
void getSensor(sensor_t*);
The getSensor() function returns basic information about the sensor. For details about the
sensor_t structure, refer to the ReadMe file (http://adafru.it/aZm) for the Adafruit Sensor
Library.
Getting and Setting the operating range:
void setRange(range_t range)
The setRange() function sets the operating range for the sensor. Higher values will have a
wider measurement range. Lower values will have more sensitivity.
Valid range constants are:
ADXL345_RANGE_16_G
ADXL345_RANGE_8_G
ADXL345_RANGE_4_G
ADXL345_RANGE_2_G (default value)
range_t getRange(void);
The getRange() function returns the current operating range as set by setRange()
Getting and Setting the Data Rate:
void setDataRate(dataRate_t dataRate);
© Adafruit Industries https://learn.adafruit.com/adxl345-digital-accelerometer Page 16 of 17