Program for FRDM-64k for read five accelerometers

Dependencies:   FXOS8700CQ LSM303D MMA8451Q MPU6050 mbed

Fork of fxos8700cq_example by Thomas Murphy

ADXL335/ADXL335.cpp

Committer:
vinajarr
Date:
2016-12-05
Revision:
2:237bd73c27e9
Parent:
1:a7e3df03721c

File content as of revision 2:237bd73c27e9:


#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;
    */
    }