Datasheet
0x5D
cap.begin(0x5A)
begin() returns true if the sensor was found on the I2C bus, and false if not.
Touch detection
99% of users will be perfectly happy just querying what sensors are currentlt touched. You
can read all at once with
cap.touched()
Which returns a 16 bit value. Each of the bottom 12 bits refers to one sensor. So if you want
to test if the #4 is touched, you can use
if (cap.touched() & (1 << 4)) { do something }
You can check its not touched with:
if (! (cap.to uched() & (1 << 4)) ) { do something }
Raw Data
You can grab the current baseline and filtered data for each sensor with
filteredData(sensornumber);
baselineData(sensornumber);
It returns a 16-bit number which is the number of counts, there's no unit like "mg" or
"capacitance". The baseline is initialized to the current ambient readings when the sensor
begin() is called - you can always reinitialize by re-calling begin()! The baseline will drift a bit,
that's normal! It is trying to compensate for humidity and other environmental changes.
If you need to change the threshholds for touch detection, you can do that with
setThreshholds(uint8_t touch, uint8_t release)
By default, the touch threshhold is 12 counts, and the release is 6 counts. It's reset to these
values whenever you call begin() by the way.
© Adafruit Industries
https://learn.adafruit.com/adafruit-mpr121-12-key-capacitive-touch-
sensor-breakout-tutorial
Page 17 of 20