Program for FRDM-64k for read five accelerometers

Dependencies:   FXOS8700CQ LSM303D MMA8451Q MPU6050 mbed

Fork of fxos8700cq_example by Thomas Murphy

Revision:
1:a7e3df03721c
Child:
2:237bd73c27e9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ADXL335/ADXL335.cpp	Thu Dec 01 08:28:52 2016 +0000
@@ -0,0 +1,34 @@
+
+#include "mbed.h"
+#include "ADXL335.h"
+
+
+ADXL335::ADXL335(PinName analogX, PinName analogY, PinName analogZ):
+    X(analogX),Y(analogY),Z(analogZ)
+    {
+    this->_scale= 0.280; //V/g
+    this->zeroGX= 1.25; 
+    this->zeroGY= 1.25;
+    this->zeroGZ= 1.28;
+    }
+
+        
+void ADXL335::setScale(double scale){
+    this->_scale = scale;
+    }
+double ADXL335::getScale(){
+    return this->_scale;
+    }
+
+void ADXL335::getAcc(SRAWDATA &acc)
+{
+ 
+    acc.x=(double(this->X.read())*3.3-this->zeroGX)/this->_scale;
+    acc.y=(double(this->Y.read())*3.3-this->zeroGY)/this->_scale;
+    acc.z=(double(this->Z.read())*3.3-this->zeroGZ)/this->_scale;
+ /*   
+    acc.x=this->X.read()*3.3;
+    acc.y=this->Y.read()*3.3;
+    acc.z=this->Z.read()*3.3;
+    */
+    }
\ No newline at end of file