Program for FRDM-64k for read five accelerometers
Dependencies: FXOS8700CQ LSM303D MMA8451Q MPU6050 mbed
Fork of fxos8700cq_example by
ADXL335/ADXL335.cpp@2:237bd73c27e9, 2016-12-05 (annotated)
- Committer:
- vinajarr
- Date:
- Mon Dec 05 09:16:43 2016 +0000
- Revision:
- 2:237bd73c27e9
- Parent:
- 1:a7e3df03721c
Uso de acelerometros a maxima velocidad
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vinajarr | 1:a7e3df03721c | 1 | |
vinajarr | 1:a7e3df03721c | 2 | #include "mbed.h" |
vinajarr | 1:a7e3df03721c | 3 | #include "ADXL335.h" |
vinajarr | 1:a7e3df03721c | 4 | |
vinajarr | 1:a7e3df03721c | 5 | |
vinajarr | 1:a7e3df03721c | 6 | ADXL335::ADXL335(PinName analogX, PinName analogY, PinName analogZ): |
vinajarr | 1:a7e3df03721c | 7 | X(analogX),Y(analogY),Z(analogZ) |
vinajarr | 1:a7e3df03721c | 8 | { |
vinajarr | 1:a7e3df03721c | 9 | this->_scale= 0.280; //V/g |
vinajarr | 1:a7e3df03721c | 10 | this->zeroGX= 1.25; |
vinajarr | 1:a7e3df03721c | 11 | this->zeroGY= 1.25; |
vinajarr | 1:a7e3df03721c | 12 | this->zeroGZ= 1.28; |
vinajarr | 1:a7e3df03721c | 13 | } |
vinajarr | 1:a7e3df03721c | 14 | |
vinajarr | 1:a7e3df03721c | 15 | |
vinajarr | 1:a7e3df03721c | 16 | void ADXL335::setScale(double scale){ |
vinajarr | 1:a7e3df03721c | 17 | this->_scale = scale; |
vinajarr | 1:a7e3df03721c | 18 | } |
vinajarr | 1:a7e3df03721c | 19 | double ADXL335::getScale(){ |
vinajarr | 1:a7e3df03721c | 20 | return this->_scale; |
vinajarr | 1:a7e3df03721c | 21 | } |
vinajarr | 1:a7e3df03721c | 22 | |
vinajarr | 1:a7e3df03721c | 23 | void ADXL335::getAcc(SRAWDATA &acc) |
vinajarr | 1:a7e3df03721c | 24 | { |
vinajarr | 1:a7e3df03721c | 25 | |
vinajarr | 2:237bd73c27e9 | 26 | //acc.x=(double(this->X.read())*3.3-this->zeroGX)/this->_scale; |
vinajarr | 2:237bd73c27e9 | 27 | //acc.y=(double(this->Y.read())*3.3-this->zeroGY)/this->_scale; |
vinajarr | 1:a7e3df03721c | 28 | acc.z=(double(this->Z.read())*3.3-this->zeroGZ)/this->_scale; |
vinajarr | 1:a7e3df03721c | 29 | /* |
vinajarr | 1:a7e3df03721c | 30 | acc.x=this->X.read()*3.3; |
vinajarr | 1:a7e3df03721c | 31 | acc.y=this->Y.read()*3.3; |
vinajarr | 1:a7e3df03721c | 32 | acc.z=this->Z.read()*3.3; |
vinajarr | 1:a7e3df03721c | 33 | */ |
vinajarr | 1:a7e3df03721c | 34 | } |