A class to receive data from the SparkFun 9DOF Razor IMU. It can be easily adapted to work with IMUs with different data formats.
imu.h
- Committer:
- avbotz
- Date:
- 2013-07-08
- Revision:
- 4:8f63393d49fb
- Parent:
- 3:f04d3d10d518
File content as of revision 4:8f63393d49fb:
#pragma once #include "mbed.h" Serial PC(USBTX, USBRX); DigitalOut myled1(LED1); DigitalOut myled2(LED2); DigitalOut myled3(LED3); DigitalOut myled4(LED4); class IMU{ public: IMU(int baud, PinName tx, PinName rx, Serial* pc); ~IMU(); void getData(); void attach(void (*fptr)(void)); void putc(char c); //void readIMU(); short accX, accY, accZ, gyrX, gyrY, gyrZ, magX, magY, magZ; bool readable; bool newData; private: Serial* p_device; Serial* p_pc; inline void makeCorrect(short* i); void parse(); int i_IMU; char bufIMU[21]; } imu(57600, p9, p10, &PC); void readIMU();