My fully self designed first stable working Quadrocopter Software.

Dependencies:   mbed

Dependents:   fluy343

/media/uploads/maetugr/dsc09031.jpg

Revision:
0:12950aa67f2a
Child:
2:03e5f7ab473f
diff -r 000000000000 -r 12950aa67f2a IMU/Sensors/Comp/HMC5883.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/IMU/Sensors/Comp/HMC5883.h	Mon Sep 02 15:04:22 2013 +0000
@@ -0,0 +1,31 @@
+// based on http://mbed.org/users/BlazeX/code/HMC5883/
+
+#ifndef HMC5883_H
+#define HMC5883_H
+
+#include "mbed.h"
+#include "I2C_Sensor.h"
+
+#define HMC5883_I2C_ADDRESS     0x3C
+
+#define HMC5883_CONF_REG_A      0x00
+#define HMC5883_CONF_REG_B      0x01
+#define HMC5883_MODE_REG        0x02
+#define HMC5883_DATA_OUT_X_MSB  0x03
+
+class HMC5883 : public I2C_Sensor
+{           
+    public:
+        HMC5883(PinName sda, PinName scl);
+        
+        virtual void read();            // read all axis from register to array data
+        void calibrate(int s);
+        float get_angle();
+         
+    private:
+        virtual void readraw();                 // function to get raw data
+        
+        float offset[3];                        // calibration offset
+};
+
+#endif