Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MPU9250_SPI mbed
Fork of MPU9250_AHRS by
main.cpp
- Committer:
- mfurukawa
- Date:
- 2016-05-23
- Revision:
- 2:9ef7a594159c
- Parent:
- 1:f1e4ee4fc335
- Child:
- 3:07aa20aa678d
File content as of revision 2:9ef7a594159c:
#include "mbed.h"
#include "ADXL362.h"
Serial pc(USBTX, USBRX);
/*
~CS (Chip Select) p8
MOSI (Master Out Slave In) p5
MISO (Master In Slave Out p6
SCK (Serial Clock) p7
*/
ADXL362 adxl362(p8, p5, p6, p7);
int main() {
pc.baud(115200);
//DigitalOut Ch1(p8);
//DigitalOut Ch2(p9);
//DigitalOut Ch3(p10);
//adxl362.set_cs_pin(&Ch1);
adxl362.reset();
wait_ms(600); // we need to wait at least 500ms after ADXL362 reset
adxl362.set_mode(ADXL362::MEASUREMENT);
uint8_t x,y,z;
uint64_t t;
while(1) {
x=adxl362.scanx_u8();
y=adxl362.scany_u8();
z=adxl362.scanz_u8();
t=adxl362.scan();
printf("x = %02x y = %02x z = %02x %04x %04x %04x\r\n",x,y,z,
static_cast<uint16_t>(0xFFFF&(t>>48)),
static_cast<uint16_t>(0xFFFF&(t>>32)),
static_cast<uint16_t>(0xFFFF&(t>>16)) );
wait_ms(1);
}
}
