Try this instead:
Wire.beginTransmission(0x10);
Wire.write(5);
Wire.endTransmission();
Wire.requestFrom(0x10, 2);
while (Wire.available())
{
data = Wire.read();
data |= Wire.read() << 8;
}
What you'll end-up doing is:
-
Tell the slave that you want it to point to its register #5
-
then tell the slave that you want to receive 2 bytes, starting from the current position of its pointer
-
when the data are going to be available, you will read them !
I never do a "Wire.endTransmission()" after a request: maybe I'm wrong, but it has never been an issue so far ...
I noticed that you were reading the value from the slave right after requesting them: might be too fast ! That's why I use the Wire.available.
Also, keep in mind that (for example) when you write, even if you do beginTransmission + write + endTransmission, all the commands get packaged ONLY when the endTransmission is executed.
hope it help ...