Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <MPR121.h>
- #include <Wire.h>
- void setup() {
- Serial.begin(9600);
- Wire.begin();
- MPR121.begin(0x5A));
- MPR121.setInterruptPin(2);
- MPR121.setTouchThreshold(5);
- MPR121.setReleaseThreshold(5);
- delay(1000);
- }
- void loop() {
- if (MPR121.touchStatusChanged()) {
- MPR121.updateTouchData();
- if (MPR121.isNewTouch(0)) {
- Serial.println("Touch pin 0");
- } else if (MPR121.isNewTouch(11)) {
- Serial.println("Touch pin 11");
- } else if (MPR121.isNewRelease(0)) {
- Serial.println("Release pin 0");
- } else if (MPR121.isNewRelease(11)) {
- Serial.println("Release pin 11");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement