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/Acc/ADXL345.cpp
- Revision:
- 26:96a072233d7a
- Parent:
- 21:c2a2e7cbabdd
- Child:
- 33:fd98776b6cc7
--- a/Sensors/Acc/ADXL345.cpp Mon Nov 26 16:11:28 2012 +0000 +++ b/Sensors/Acc/ADXL345.cpp Tue Nov 27 19:49:38 2012 +0000 @@ -49,18 +49,6 @@ data[0] = (short) ((int)buffer[1] << 8 | (int)buffer[0]); data[1] = (short) ((int)buffer[3] << 8 | (int)buffer[2]); data[2] = (short) ((int)buffer[5] << 8 | (int)buffer[4]); - - // calculate the angles for roll and pitch (0,1) - float R = sqrt(pow((float)data[0],2) + pow((float)data[1],2) + pow((float)data[2],2)); - float temp[3]; - - temp[0] = -(Rad2Deg * acos((float)data[1] / R)-90); - temp[1] = Rad2Deg * acos((float)data[0] / R)-90; - temp[2] = Rad2Deg * acos((float)data[2] / R); - - for(int i = 0;i < 3; i++) - if (temp[i] > -360 && temp[i] < 360) - angle[i] = temp[i]; } void ADXL345::writeReg(char address, char data){