سلام

من توی بخش راهنما تاپیکی پیدا نکردم بنابر این تاپیکیدم!

به شدت این کی پد روی اعصاب بود اما بالاخره حل شد. ضمنا رابطش i2c نیست.

کد:
//Test program for TTP229-B 16 capacitive keys module //The module works with a basic serial interface : // The arduino sends a clock on the SCL pin and retrieves a bit from the SDO // pin for each clock step //When delivered, the module is only capable of 8 keys, single touch, active low //To access options, it is necessary to solder pins on the the P1 and P2 headers // and use straps to enable the different functions //P1 : 3 enables the 16 keys mode //P1 : 2 enables active high mode //P1 : 4 and P2 : 5 : multitouch mode : if both are strapped, full 16 keys // multitouch is enabled //The GetKeys function retrieves all 16 keys. // Bit 15 is key 1 and bit 0 is key 15 //If the 8 keys mode is enabled, then the two bytes of the integer // have the same value //The module has to be wired to the following Arduino pins : // TTP Arduino // VCC 5V // GND GND // SCL D13 (or modify the CLOCK define) // SDO D12 (or modify the KEYS define) #define KEYS 12 #define CLOCK 13 unsigned int keys = 0; void setup() { Serial.begin(9600); pinMode(KEYS, INPUT); pinMode(CLOCK, OUTPUT); delay(100); } unsigned int GetKeys() { keys = 0; byte currbit = LOW; delay(3); //after 2ms without clock, the TTP229 resets, //so, this ensures to get the 16 keys in the expected order for (byte i=0;i<16;i++) { digitalWrite(CLOCK,HIGH); delayMicroseconds(10); digitalWrite(CLOCK,LOW); delayMicroseconds(10); currbit = digitalRead(KEYS); if (currbit==HIGH) { //= If active High is set. Otherwise, invert the test keys=keys*2+1; } else { keys=keys*2; } } return keys; } void loop() { Serial.println(GetKeys(), BIN); delay(100); }
توجه داشته باشید این کد خیلی پیشرفته نیست و فقط با توجه به کلیدی که فشار میدید 0 و 1 نمایش میده!

فقط میتونید با این متوجه بشید که سالمه. همین.