Line 31: |
Line 31: |
| #include <Wire.h> | | #include <Wire.h> |
| #include "Adafruit_MPR121.h" | | #include "Adafruit_MPR121.h" |
− |
| |
| #include <AccelStepper.h> | | #include <AccelStepper.h> |
| | | |
Line 40: |
Line 39: |
| | | |
| Adafruit_MPR121 cap = Adafruit_MPR121(); | | Adafruit_MPR121 cap = Adafruit_MPR121(); |
− |
| |
| uint16_t lasttouched = 0; | | uint16_t lasttouched = 0; |
| uint16_t currtouched = 0; | | uint16_t currtouched = 0; |
Line 67: |
Line 65: |
| } | | } |
| Serial.println("MPR121 found!"); | | Serial.println("MPR121 found!"); |
− |
| |
| // to change threshold sensitivites (touched, released). Defaults are (12,6). Valuess from 0-255 = less-more sensitive. | | // to change threshold sensitivites (touched, released). Defaults are (12,6). Valuess from 0-255 = less-more sensitive. |
| cap.setThresholds(24, 12); | | cap.setThresholds(24, 12); |
Line 101: |
Line 98: |
| } | | } |
| } | | } |
− |
| |
| // reset our state | | // reset our state |
| lasttouched = currtouched; | | lasttouched = currtouched; |
− |
| |
| // comment out "return" line for detailed data from the sensor! | | // comment out "return" line for detailed data from the sensor! |
| return; | | return; |
− |
| |
| // debugging info, what | | // debugging info, what |
| Serial.print("\t\t\t\t\t\t\t\t\t\t\t\t\t 0x"); Serial.println(cap.touched(), HEX); | | Serial.print("\t\t\t\t\t\t\t\t\t\t\t\t\t 0x"); Serial.println(cap.touched(), HEX); |
Line 119: |
Line 113: |
| Serial.print(cap.baselineData(i)); Serial.print("\t"); | | Serial.print(cap.baselineData(i)); Serial.print("\t"); |
| } | | } |
− | Serial.println(); | + | Serial.println(); |
− |
| |
| // put a delay so it isn't overwhelming | | // put a delay so it isn't overwhelming |
| delay(100); | | delay(100); |