Pages: [1]   Go Down
Author Topic: Arduino Library for the Atmel AT42QT1070 Touch Capacitance chip  (Read 2557 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
I love YaBB 1G - SP1!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

So recently I have been developing an arduino based camera trigger device called http://triggertrap.com/ which uses 4 touch capacitance buttons for its main interface. The device specifically uses the Atmel AT42QT1070 in "Comms" mode (using i2c). So rather then just write some one off code for the project, I decided to transform the touch capacitance code into an Arduino Library.

You can download it here: https://github.com/slugmobile/AtTouch

I made a small write up on my blog of how to use it here: http://n0m1.com/2011/08/01/attouch-library-for-arduino-and-the-at42qt1070/

Just to get you started though, here is the code in loop() from one of the examples

Code:
if(touch.hit() == true) //checks if the hit flag has been triggered by the interrupt
  {
hitKeyNum = touch.readActiveKey();
   digitalWrite(ledPin,HIGH);

   if(hitKeyNum == 9) //key #9 is end of key press signal (key up)
   {
     Serial.println("keyUP");
   }
   else
   {
       Serial.print("button #");
       Serial.print(hitKeyVal);  
       Serial.println(" Down");
   }
  }

Other then that loop() code you just need to instantiate the object, and declare your variables. Dead simple. There is also an example included in the library that shows how to detect press and hold.

If you have any feed back on the library (things to change, etc) please let me know! I hope some people find this useful!
« Last Edit: February 07, 2012, 12:22:20 am by aleph8nought » Logged

Pages: [1]   Go Up
Jump to: