/* * touchpad16_interrupt.ino * * Created: 5/27/2015 9:02:08 PM * Author: Steve Stover * * 16 Key Capacitive Touchpad using TTP229B IC * http://www.ebay.com/itm/371304274498 * * The Touchpad has a jumper on TP1/SAHL for active high serial out * and a jumper on TP2/KYSEL for 16-keys operation * * Processing the input via external interrupt INT1 * on an Arduino Nano v3.0 */ #include #define CLR(x,y) (x&=(~(1<> b) & 1) { Serial.print('\t'); Serial.print("bit "); Serial.print(b); Serial.print('\t'); Serial.print("pad "); Serial.print(b+1); } } Serial.println(); } } ISR(INT1_vect) { touchVal = 0; delayMicroseconds(100); for (byte i=0; i<=15; i++) { SET(PORTD, clock_Pin); delayMicroseconds(50); touchVal |= (digitalRead(sdo_Pin) << i); CLR(PORTD, clock_Pin); delayMicroseconds(50); } }