Go Down

Topic: Arduino Library for the Atmel AT42QT1070 Touch Capacitance chip (Read 2720 times) previous topic - next topic

aleph8nought

Aug 01, 2011, 09:19 am Last Edit: Feb 07, 2012, 06:22 am by aleph8nought Reason: 1
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: [Select]
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!

Go Up