Skip to content

Instantly share code, notes, and snippets.

@pearlchen
Created May 10, 2015 02:05
Show Gist options
  • Save pearlchen/7a85cdc111f9f392be03 to your computer and use it in GitHub Desktop.
Save pearlchen/7a85cdc111f9f392be03 to your computer and use it in GitHub Desktop.
Xadow Touch Sensor
// example code of touch numbers (replaces getTouchNumber)
#include <Wire.h>
#include "Seeed_QTouch.h"
#include <SeeedOLED.h>
void setup()
{
Serial.begin(9600);
Wire.begin();
QTouch.reset(); //resets touch sensor
QTouch.calibrate(); //calibrates sensor
QTouch.setNTHRForKey(6, 0); //sets negative threshold
SeeedOled.init();
SeeedOled.clearDisplay(); //clear the screen and set start position to top left corner
SeeedOled.setNormalDisplay(); //Set display to normal mode (i.e non-inverse mode)
SeeedOled.setPageMode(); //Set addressing mode to Page Mode
SeeedOled.setTextXY(0,0); //Set the cursor to Xth Page, Yth Column
SeeedOled.putString("Hello World!"); //Print the String
}
void loop()
{
int tn = QTouch.touchNum();
if(tn>=0)
{
Serial.println(tn); //should return the value of the capacitor pad
}
delay(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment