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:
2018-01-18
Revision:
4:c6b4d8c152cd
Parent:
2:237bd73c27e9

File content as of revision 4:c6b4d8c152cd:


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