How to read a register value using the Wire library

It's very similar to the write command.
And, it's used in that same example code, here -

[code]
  //read the touch state from the MPR121
  Wire.requestFrom(0x5A,2); 
  
  byte LSB = Wire.read();
  byte MSB = Wire.read();
  
  uint16_t touched = ((MSB << 8) | LSB); //16bits that make up the touch states

To understand that, you should first understand how the write command operates.

    Wire.beginTransmission(address);

This begins transmission to slave device, where 'address' is the slave device's address.

    Wire.write(r);

This first byte written here 'r' moves the register pointer to the register with address 'r'. You can think of the pointer as a read/write head.

    Wire.write(v);

Now that the pointer is 'pointing' at the specific register you wanted, this command will replace the byte stored in that register with the value 'v'.

    Wire.endTransmission();

This tells the slave that you're done giving it instructions for now.
If, instead of sending endTransmission... Another Wire.write(v1) was sent, the slave device would've automatically incremented the pointer to the next address (r+1) and written 'v1' into that register.

If you want to read from a specific register, you must first move the pointer to that address with a write() command. Then, we can request the number of bytes we want, and use read() to assign those incoming values to variables. Finally, we end the transmission.

For example :

Wire.beginTransmission(address);    // Get the slave's attention, tell it we're sending a command byte
Wire.write(0x32);                               //  The command byte, sets pointer to register with address of 0x32
Wire.requestFrom(address,1);          // Tell slave we need to read 1byte from the current register
byte slaveByte2 = Wire.read();        // read that byte into 'slaveByte2' variable
Wire.endTransmission();                  // "Hang up the line" so others can use it (can have multiple slaves & masters connected)

Since the register addresses for touch status in the MPR121 are 0x00 and 0x01, the example code doesn't need to move the register pointer before requesting bytes. And, since it requests two bytes....it reads register 0x00, automatically moves pointer to next address, and reads out register 0x01.

This little part just concatenates the two individual 8-bit bytes into one 16-bit variable.

  uint16_t touched = ((MSB << 8) | LSB); //16bits that make up the touch states

By shifting MSB to left 8 bits/positions and performing a bitwise OR to combine them

If MSB == 00110100 and LSB == 11110011
then
MSB<<8 == 0011010000000000
and
touched == 0011010011110011[/code]

More info here -