NOT FINISHED YET!!! My first try to get a self built fully working Quadrocopter based on an mbed, a self built frame and some other more or less cheap parts.

Dependencies:   mbed MODI2C

Committer:
maetugr
Date:
Mon Nov 05 09:19:01 2012 +0000
Revision:
20:e116e596e540
Parent:
19:40c252b4a792
Eine Achse stabil! bereits abgehoben an Schnur! (erst Gyro im I2C_Sensor)(acos nan abgefangen)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maetugr 17:e096e85f6c36 1 // based on http://mbed.org/users/BlazeX/code/HMC5883/
maetugr 17:e096e85f6c36 2
maetugr 11:9bf69bc6df45 3 #ifndef HMC5883_H
maetugr 11:9bf69bc6df45 4 #define HMC5883_H
maetugr 11:9bf69bc6df45 5
maetugr 17:e096e85f6c36 6 #include "mbed.h"
maetugr 17:e096e85f6c36 7 #include "I2C_Sensor.h"
maetugr 17:e096e85f6c36 8
maetugr 19:40c252b4a792 9 #define HMC5883_I2C_ADDRESS 0x3C
maetugr 18:c8c09a3913ba 10
maetugr 11:9bf69bc6df45 11 #define HMC5883_CONF_REG_A 0x00
maetugr 11:9bf69bc6df45 12 #define HMC5883_CONF_REG_B 0x01
maetugr 11:9bf69bc6df45 13 #define HMC5883_MODE_REG 0x02
maetugr 11:9bf69bc6df45 14 #define HMC5883_DATA_OUT_X_MSB 0x03
maetugr 11:9bf69bc6df45 15
maetugr 17:e096e85f6c36 16 class HMC5883 : public I2C_Sensor
maetugr 11:9bf69bc6df45 17 {
maetugr 11:9bf69bc6df45 18 public:
maetugr 11:9bf69bc6df45 19 HMC5883(PinName sda, PinName scl);
maetugr 11:9bf69bc6df45 20
maetugr 18:c8c09a3913ba 21 virtual void read(); // read all axis from register to array data
maetugr 12:67a06c9b69d5 22 void calibrate(int s);
maetugr 12:67a06c9b69d5 23 float get_angle();
maetugr 12:67a06c9b69d5 24
maetugr 12:67a06c9b69d5 25 private:
maetugr 20:e116e596e540 26 virtual void readraw(); // function to get raw data
maetugr 12:67a06c9b69d5 27
maetugr 18:c8c09a3913ba 28 float scale[3]; // calibration parameters
maetugr 14:cf260677ecde 29 float offset[3];
maetugr 11:9bf69bc6df45 30 };
maetugr 11:9bf69bc6df45 31
maetugr 11:9bf69bc6df45 32 #endif