captouch (community library)

Summary

Name Value
Name captouch
Version 0.0.1
Installs
License LGPL3
Author David Greaves david@dgreaves.com
URL https://github.com/lbt/captouch
Repository https://github.com/lbt/captouch.git
Download .tar.gz

Capacitative Touch sensor using just a 10M resistor

Library Read Me

This content is provided by the library maintainer and has not been validated or approved. CapTouch is library to provide simple touch sensor for the Spark.

A port of John van Saders' code to a library and a C++/Class based solution.

See: http://jvs.me/touch-sensing-on-the-spark-core/

Usage:


#include "captouch.h"

// Define which pins are connected with a 1-10M resistor.
// The first pin will be connected to the touch sensor
// and *must* be D0, D1, D2, D3, D4 A0, A1, A3, A4, A5, A6, A7
// see: http://docs.spark.io/firmware/#interrupts-attachinterrupt
CapTouch Touch(D4, D5);

setup() {
Touch.setup();
}

loop() {

CapTouch::Event touchEvent = Touch.getEvent();

if (touchEvent == CapTouch::TouchEvent) {
digitalWrite(D7, HIGH); // LED on
} else if (touchEvent == CapTouch::ReleaseEvent) {
digitalWrite(D7, LOW);  // LED off
}

delay(100);
}

Browse Library Files