.

Dependencies:   BNO055 SDFileSystem mbed

main.cpp

Committer:
alejo5214416
Date:
2018-08-31
Revision:
0:b91b6f47eb98
Child:
1:74fb432755d0

File content as of revision 0:b91b6f47eb98:

#include "mbed.h"
#include "BNO055.h"
using namespace std;
 
DigitalOut led1(LED1);
Serial pc(USBTX, USBRX); 
// BNO055
BNO055 bno055(p9, p10);
InterruptIn interrupt(p15,PullUp); 

 
 
void event();
int main() {
    
    bno055.reset();
    bno055.setmode(OPERATION_MODE_NDOF);
    bno055.write_calibration_data();
    bno055.get_calib();
    interrupt.rise(&event);
    //bno055.initIntr();//inicializar la interrupcion;
    while (bno055.calib == 0) {
        bno055.get_calib();
    }
    bno055.resetIntr();
    while(1) {
        bno055.get_angles(); //query the i2c device
        //pc.printf("yaw:%6.2f pitch:%6.2f roll:%6.2f\r\n",bno055.euler.yaw, bno055.euler.pitch, bno055.euler.roll);
        bno055.get_lia(); //query the i2c device
        pc.printf("X: %3.2f, Y: %3.2f, Z: %3.2f\r\n",bno055.lia.x,bno055.lia.y,bno055.lia.z);
        wait_ms(50);
        
    }
}



void event(){
    led1=1;
    wait(1);
    led1=0;
    bno055.resetIntr();
    }