![](/media/cache/profiles/8ad6635f33710af6a535e8fb8486975e.50x50_q85.jpg)
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.
Sensors/I2C_Sensor.h
- Committer:
- maetugr
- Date:
- 2012-10-31
- Revision:
- 17:e096e85f6c36
- Parent:
- 16:74a6531350b5
- Child:
- 18:c8c09a3913ba
File content as of revision 17:e096e85f6c36:
// by MaEtUgR #ifndef I2C_Sensor_H #define I2C_Sensor_H #include "mbed.h" class I2C_Sensor { public: I2C_Sensor(PinName sda, PinName scl, int8_t address); float data[3]; void read(); void calibrate(); protected: // Calibration value saving void saveCalibrationValues(float values[], int size, char * filename); void loadCalibrationValues(float values[], int size, char * filename); // I2C functions char readRegister(char reg); void writeRegister(char reg, char data); void readMultiRegister(char reg, char* output, int size); // raw data and function to measure it int raw[3]; void readraw(); private: I2C i2c; // I2C-Bus int8_t i2c_address; // address LocalFileSystem local; // file access to save calibration values }; #endif