imu rev1

Dependencies:   IMUfilter mbed

Fork of AIviate by UCLA IEEE

steps.cpp

Committer:
teamgoat
Date:
2013-11-01
Revision:
3:f9e18a9cd9af
Parent:
2:452dd766d212
Child:
4:44a5b1e8fd27

File content as of revision 3:f9e18a9cd9af:

#include "steps.h"

Serial pc(USBTX, USBRX);

// in the future, change get_sensor_data to append the sensor data to a rolling list 
void get_sensor_data()
{
    struct sensor s;
    if (read_accelerometer(&s) == 0)
    {
        pc.printf("Error in get_sensor_data while reading from accel!\r\n");
        return;
    }
    if (read_gyro(&s) == 0)
    {
        pc.printf("Error in get_sensor_data while reading from gyro!\r\n");
        return;
    }
    pc.printf("Ax: %i Ay: %i Az: %i Gx: %i Gy: %i Gz: %i\r\n", s.ax, s.ay, s.az, s.gx, s.gy, s.gz);
    return;
}

void init_sensors()
{
    // create config struct
    struct config c;
    
    // set configurations
    c.frequency = 10000;
    
    // pass configuration struct to configuration routine
    int ret = config_gy80(&c);
    if (ret == 0)
    {
        pc.printf("Error configuring sensors\r\n");
    }
}