I'm trying to rearrange the binary numbers. I'm getting zero for my x and y which is correct, but when I move it just a little bit, the number goes to 127 which means that I need to organized the bytes. I'm trying to read register 0x33 before 0x32 for the x value, 0x35 before 0x34 for y value, and 0x37 before 0x36, but I don't know how. If anyone knows how, please let me know!
Below is the code that I'm using to read the data:
// === Read acceleromter data === //
Wire.write(0x32); // Start with register 0x32
Wire.requestFrom(ADXL313, 6, true); // Read 6 registers total, each axis value is stored in 2 registers
X_out = ( Wire.read()| Wire.read() << 8); // X-axis value
Y_out = ( Wire.read()| Wire.read() << 8); // Y-axis value
Z_out = ( Wire.read()| Wire.read() << 8); // Z-axis value