ADXL345 triple axis, digital accelerometer library.
Fork of ADXL345 by
Diff: ADXL345.cpp
- Revision:
- 1:0fac771fec8d
- Parent:
- 0:bd8f0f20f433
diff -r bd8f0f20f433 -r 0fac771fec8d ADXL345.cpp --- a/ADXL345.cpp Mon Sep 06 13:53:03 2010 +0000 +++ b/ADXL345.cpp Wed Feb 24 21:45:22 2016 +0000 @@ -313,15 +313,15 @@ } -void ADXL345::getOutput(int* readings){ +void ADXL345::getOutput(short* readings){ char buffer[6]; multiByteRead(ADXL345_DATAX0_REG, buffer, 6); - readings[0] = (int)buffer[1] << 8 | (int)buffer[0]; - readings[1] = (int)buffer[3] << 8 | (int)buffer[2]; - readings[2] = (int)buffer[5] << 8 | (int)buffer[4]; + readings[0] = (short)buffer[1] << 8 | (short)buffer[0]; + readings[1] = (short)buffer[3] << 8 | (short)buffer[2]; + readings[2] = (short)buffer[5] << 8 | (short)buffer[4]; }