A C library for using an MPR121-based touch sensor with the Raspberry Pi Pico
The MPR121 is a capacitive touch sensor controller with 12 electrodes. While NXP have now discontinued this sensor, touch sensor boards based on this chip are still available, e.g. Adafruit product 1982 and Seeed Studio Grove I2C Touch Sensor.
MPR121 | Pico |
---|---|
SDA | SDA (e.g. pin 8) |
SCL | SCL (e.g. pin 9) |
VDD | 3V3(OUT) |
GND | GND |
- Configure
CMakeLists.txt
in your base project to include the path to the pico-mpr121 library. Add pico-mpr121 to the list of target libraries. E.g. if the pico-mpr121 library is located one directory above (../
) the current one yourCMakeLists.txt
file should include
.
.
.
include(pico_sdk_import.cmake)
add_subdirectory(../pico-mpr121/lib mpr121)
target_link_libraries(touch
pico_stdlib
hardware_i2c
pico-mpr121
)
.
.
.
- Use the library; see the examples directory.