We bought a MPU 6050 gyro/accelerometer from Sparkfun Electronics. The spec sheet says the I2C address is 0x68 and that the WhoAmI register is at adress 075. When we read from that address we get the expected output of 104 decimal (0x68). When we tried to read the gyro register, at 0x43 - 0x47, we only get zeros. When we try to read the temperature register, we also get zeros. Is there something we have to do to enable reporting of the values?
Code:
private I2C gyro = new I2C(I2C.Port.kOnboard, 0x68);
protected void initialize () {
gyro.write(0x6B, 0x80);
}
protected void execute () {
byte[] whoAmI = new byte[1];
gyro.read(0x75, 1, whoAmI);
System.out.println("WhoAmI: " + whoAmI[0]);
for (int i = 0x43; i <= 0x47; i += 0x02) {
byte[] angle = new byte[2];
gyro.read(i, 2, angle);
System.out.println(i + ": " + angle[0] + "" + angle[1]);
}
}
protected boolean isFinished () {
return false;
}
protected void end () {
}
protected void interrupted () {
end();
}