
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
(https://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);
The setDataRate() function sets the rate at which the sensor output is updated. Rates above 100 Hz will exhibit
increased noise. Rates below 6.25 Hz will be more sensitive to temperature variations. See the
data
sheet
(https://adafru.it/c5e)
for details.
Valid data rate constants are:
ADXL345_DATARATE_3200_HZ
© Adafruit Industries
https://learn.adafruit.com/adxl345-digital-accelerometer
Page 14 of 17
Summary of Contents for ADXL345
Page 1: ...ADXL345 Digital Accelerometer Created by Bill Earl Last updated on 2018 12 07 07 32 33 PM UTC ...
Page 4: ... Adafruit Industries https learn adafruit com adxl345 digital accelerometer Page 4 of 17 ...
Page 7: ... Adafruit Industries https learn adafruit com adxl345 digital accelerometer Page 7 of 17 ...
Page 17: ... Adafruit Industries Last Updated 2018 12 07 07 32 32 PM UTC Page 17 of 17 ...