Hello:
I have a problem with the library wire.h and board Maple Mini. When I try to read multiples registers, only I can read ok the first register. When the function Wire.recive() reads the other registers, after the first register, the function gives the value of the first register.
With board Arduino Uno and your library Wire.h this problem doesn't happend.
The code I use is this:
Wire.beginTransmission(REG_GYRO);
Wire.send(REG_GYRO_X); //Register Address GYRO_XOUT_H
Wire.endTransmission();
// New read the 6 data bytes
Wire.beginTransmission(GYRO);
Wire.requestFrom(GYRO,6); // Read 6 bytes
i = 0;
while(Wire.available())
{
buffer[i] = Wire.receive();
i++;
}
Wire.endTransmission();
//Combine bytes into integers
// Gyro format is MSB first
gyro_x = buffer[0] << 8 | buffer[1];
gyro_y = buffer[2] << 8 | buffer[3];
gyro_z = buffer[4] << 8 | buffer[5];
To read the registers correctly, I have read registers independently, increasing the cycle time.
is it possible the library has and error?
HELP ME PLIS!!!