https://github.com/stm32duino/iis2dlpc
Arduino library to support the IIS2DLPC 3D accelerometer
https://github.com/stm32duino/iis2dlpc
Last synced: 3 months ago
JSON representation
Arduino library to support the IIS2DLPC 3D accelerometer
- Host: GitHub
- URL: https://github.com/stm32duino/iis2dlpc
- Owner: stm32duino
- License: bsd-3-clause
- Created: 2020-10-01T08:29:05.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-10-05T16:15:03.000Z (over 4 years ago)
- Last Synced: 2024-12-31T12:52:03.575Z (over 1 year ago)
- Language: C
- Size: 28.3 KB
- Stars: 0
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IIS2DLPC
Arduino library to support the IIS2DLPC 3D accelerometer
## API
This sensor uses I2C or SPI to communicate.
For I2C it is then required to create a TwoWire interface before accessing to the sensors:
TwoWire dev_i2c(I2C_SDA, I2C_SCL);
dev_i2c.begin();
For SPI it is then required to create a SPI interface before accessing to the sensors:
SPIClass dev_spi(SPI_MOSI, SPI_MISO, SPI_SCK);
dev_spi.begin();
An instance can be created and enabled when the I2C bus is used following the procedure below:
IIS2DLPCSensor Accelero(&dev_i2c);
Accelero.begin();
Accelero.Enable();
An instance can be created and enabled when the SPI bus is used following the procedure below:
IIS2DLPCSensor Accelero(&dev_spi, CS_PIN);
Accelero.begin();
Accelero.Enable();
The access to the sensor values is done as explained below:
Read accelerometer.
int32_t accelerometer[3];
Accelero.GetAxes(accelerometer);
## Documentation
You can find the source files at
https://github.com/stm32duino/IIS2DLPC
The IIS2DLPC datasheet is available at
https://www.st.com/en/mems-and-sensors/iis2dlpc.html