Download Print this page

sparkfun MPR121 Hook-Up Manual page 20

Advertisement

        phoneNumber[i] = '3';
      Serial.print(phoneNumber[i]);
      i++;
    } 
else if (touchNumber == 0)
      ; 
else
      Serial.println("Only touch ONE button!");
  } 
The next section of the code simply steps through the I C communication to
read data from the MPR121 IC.
byte mpr121Read(uint8_t address)
  byte data; 
i2cSendStart();
i2cWaitForComplete();
i2cSendByte(MPR121_W);    // write 0xB4
i2cWaitForComplete();
i2cSendByte(address); // write register address
i2cWaitForComplete();
i2cSendStart();
i2cSendByte(MPR121_R);    // write 0xB5
i2cWaitForComplete();
i2cReceiveByte(TRUE);
i2cWaitForComplete();
  data = i2cGetReceivedByte();  // Get MSB result
i2cWaitForComplete();
i2cSendStop();
cbi(TWCR, TWEN);  // Disable TWI
sbi(TWCR, TWEN);  // Enable TWI
return data;
The function
mpr121Write()
the I C process of writing commands to the MPR121 sensor.
2
is then defined, which again, steps through
2
Page 20 of 24

Advertisement

loading
Need help?

Need help?

Do you have a question about the MPR121 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Mpr121qr2