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.
Diff: Sensors/I2C_Sensor.h
- Revision:
- 14:cf260677ecde
- Child:
- 15:753c5d6a63b3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sensors/I2C_Sensor.h Sat Oct 27 10:53:43 2012 +0000 @@ -0,0 +1,30 @@ +#ifndef I2C_Sensor_H +#define I2C_Sensor_H + +class I2C_Sensor +{ + public: + I2C_Sensor(PinName sda, PinName scl, int8_t address); + + float data[3]; + void read(); + void calibrate(); + + protected: + // I2C functions + void writeRegister(char address, char data); + void readMultiRegister(char address, char* output, int size); + + private: + I2C i2c; // I2C-Bus + + int8_t i2c_address; // address + + // raw data and function to measure it + int raw[3]; + void readraw(); + + LocalFileSystem local; // file access to save calibration values +}; + +#endif