ADXL362 accelerometer hello world

Dependencies:   ADXL362 mbed

Dependents:   MPU-9250-Ch2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "ADXL362.h"
00003 
00004 ADXL362 adxl362(D9);
00005 
00006 int main() {
00007     
00008     adxl362.reset();
00009     wait_ms(600); // we need to wait at least 500ms after ADXL362 reset
00010     adxl362.set_mode(ADXL362::MEASUREMENT);
00011     uint8_t x,y,z; 
00012     while(1) {
00013         x=adxl362.scanx_u8();
00014         y=adxl362.scany_u8();
00015         z=adxl362.scanz_u8();
00016         printf("x = %x y = %x z = %x\r\n",x,y,z);
00017         wait_ms(100);
00018     }
00019 }