![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Sample program on how to use the LIS3DH sensor on the RAKWireless iTracker module
main.cpp
- Committer:
- knaresh89
- Date:
- 2018-02-12
- Revision:
- 0:cd96b05ace6e
File content as of revision 0:cd96b05ace6e:
#include "mbed.h" #include "SEGGER_RTT.h" #include "LIS3DH.h" // main() runs in its own thread in the OS int main() { I2C i2c(p19,p18); // SDA, SCL LIS3DH acc(i2c, LIS3DH_V_CHIP_ADDR, LIS3DH_DR_NR_LP_50HZ, LIS3DH_FS_8G); SEGGER_RTT_printf(0, "dev id is %d \n", acc.read_id()); if (acc.read_id() == I_AM_LIS3DH){ while(1) { float f[3]; acc.read_data(f); wait(0.5); } } }