Description
Keypad, Capacitive Touch Pad, 16 Key Control Board
This low-cost capacitive touch pad/keypad can give your next project up to 16 capacitive switches using the TTP229 IC. This means that using only power, ground, and any 2 GPIO pins as clock and data (they are not i2C) on your microcontroller.
Using the Capacitive Touch Pad with Arduino:
Firstly you want to connect up the keypad as below. Although you can use any pins you like, just tweak the code to suit.
We have example Arduino code to get you started here:
[code lang="arduino"]
// Use any 2 pins you like - this is NOT I2C ;-)
#define SCL_PIN 8
#define SDO_PIN 9
byte Key;
void setup()
{
Serial.begin(9600);
Serial.println("Cap key board");
pinMode(SCL_PIN, OUTPUT);
pinMode(SDO_PIN, INPUT);
}
void loop()
{
Key = Read_Keypad();
if (Key)
{
Serial.println(Key);
delay(200);
}
}
byte Read_Keypad(void)
{
byte pinCount;
byte KeyCount = 0;
for (pinCount = 1; pinCount <= 16; pinCount++)
{
digitalWrite(SCL_PIN, LOW);
if (digitalRead(SDO_PIN) == LOW)
{
KeyCount = pinCount;
}
digitalWrite(SCL_PIN, HIGH);
}
return KeyCount;
}
[/code]