User Guide

1/16/2018 H3LIS331DL Accelerometer Breakout Hookup Guide - learn.sparkfun.com
https://learn.sparkfun.com/tutorials/h3lis331dl-accelerometer-breakout-hookup-guide?_ga=2.255828235.2084638943.1516049849-204410570.150963…
3/7
CS Pin - Chip select for SPI mode. Unused in I C mode.
Interrupt Pins - These pins are tied to interrupts that can be setup by the software library to trigger on various conditions.
Library Overview
Here’s a list of the functions supported by the Arduino library for the LIS331 family.
begin(comm_mode mode) - Sets the communications mode to be used by the library ( LIS331::USE_I2C or LIS331::USE_SPI ),
sets the power mode to normal, enables the axes, sets the sampling rate to 50Hz, and resets all the other registers to 0.
setI2CAddr(address) - Sets the I C address. By default this is going to be 0x19. If the SA0 jumper is soldered closed, it is
0x18. This function must be called before begin() so the library knows what address to use for communications.
setSPICSPin(pin) - Sets the SPI mode chip select pin. This function must be called before begin() so the library knows
which pin to use for communications.
axesEnable(bool enable) - Pass true to enable the axes or false to disable them.
setPowerMode(power_mode pmode) - Sets the power mode of the chip. This affects the data rate as well. Options are:
LIS331::POWER_DOWN - Minimizes chip power usage but no data or communications are possible
LIS331::NORMAL - Normal power mode. Data rate is set by the setODR() function.
LIS331::LOW_POWER_0_5HZ - Low power mode, 0.5Hz data rate.
LIS331::LOW_POWER_1HZ - Low power mode, 1Hz data rate.
LIS331::LOW_POWER_2HZ - Low power mode, 2Hz data rate.
LIS331::LOW_POWER_5HZ - Low power mode, 5Hz data rate.
LIS331::LOW_POWER_10HZ - Low power mode, 10Hz data rate.
setODR(data_rate drate) - Sets the data rate for the part, when in normal power mode only. Options are:
LIS331::DR_50HZ - Set the data rate to 50Hz.
LIS331::DR_100HZ - Set the data rate to 100Hz.
LIS331::DR_400HZ - Set the data rate to 400Hz.
LIS331::DR_1000HZ - Set the data rate to 1000Hz.
readAxes(int16_t &x, int16_t &y, int16_t &z) - Pass three int16_t variables to this function and those variables will be
populated with the appropriate value from the accelerometer.
2
2