A capacitive touch sensor using a analog input port.

Dependents:   TouchSenseTestProgram

Embed: (wiki syntax)

« Back to documentation index

TouchSense Class Reference

TouchSense Class Reference

A capacitive touch sensor using analog input port. More...

#include <TouchSense.h>

Public Member Functions

 TouchSense (PinName pin, int thr=10)
 Create a TouchSense connected to the specified pin.

Detailed Description

A capacitive touch sensor using analog input port.

Example:

 #include "mbed.h"

 TouchSense tp(p18);

 int main() {
     tp.calibration();
     while(1) {
         if (tp.sense()) {
             printf("ON\r\n");
         } else {
             printf("OFF\r\n");
         }
         wait(0.1);
     }
 }

Definition at line 49 of file TouchSense.h.


Constructor & Destructor Documentation

TouchSense ( PinName  pin,
int  thr = 10 
)

Create a TouchSense connected to the specified pin.

Parameters:
pinTouchSense pin to connect to
thrThreshold (1 to 20)

Definition at line 59 of file TouchSense.h.