use of com.robo4j.math.geometry.Float3D in project robo4j by Robo4J.
the class GyroL3GD20Device method read.
public Float3D read() throws IOException {
byte[] xyz = new byte[6];
Float3D data = new Float3D();
i2cDevice.write((byte) (REGISTER_OUT_X_L | 0x80));
i2cDevice.read(REGISTER_OUT_X_H | 0x80, xyz, 0, 6);
int x = (xyz[1] & 0xFF | (xyz[0] << 8));
int y = (xyz[3] & 0xFF | (xyz[2] << 8));
int z = (xyz[5] & 0xFF | (xyz[4] << 8));
data.x = x * sensitivity.getSensitivityFactor();
data.y = y * sensitivity.getSensitivityFactor();
data.z = z * sensitivity.getSensitivityFactor();
return data;
}
Aggregations