A class to receive data from the SparkFun 9DOF Razor IMU. It can be easily adapted to work with IMUs with different data formats.

Dependencies:   mbed

Revision:
2:d8b182fbe018
Child:
3:f04d3d10d518
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/imu.h	Fri Nov 04 22:24:02 2011 +0000
@@ -0,0 +1,34 @@
+#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;
+        
+    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();