Simple step tracking

Dependencies:   MPU9250 mbed-os

Fork of ST by alonso palomino

main.cpp

Committer:
alonsopg
Date:
2017-10-12
Revision:
0:30a995e45e2a
Child:
1:3eec9883598a

File content as of revision 0:30a995e45e2a:

#include "mbed.h"
#include "MPU9250.h"

// Serial comms
Serial pc(USBTX, USBRX);

// Sensor board library
MPU9250 mpu = MPU9250(p26, p27);

// Configuration
bool test_comms = true;
bool do_sensor_init = false;
bool do_sensor_self_test = true;
bool print_accel = true;
bool print_gyro = true;

int main () {
    float test_result[6] = {0.0,0.0,0.0,0.0,0.0,0.0};
    int16_t accel[3] = {0,0,0};
    int16_t gyro[3] = {0,0,0};
    int16_t temp = 0;
    
    // Test MPU connection
    if (test_comms) {
        uint8_t whoami = mpu.readByte(MPU9250_ADDRESS, WHO_AM_I_MPU9250);  // Read WHO_AM_I register for MPU-9250
        pc.printf("I AM 0x%x\n\r", whoami); 
        pc.printf("I SHOULD BE 0x71\n\r");
        wait(1);   
    }  
    
    while(1) {
        pc.printf("Hi hi");                    
    } 
}