Manual
Example Application
This example prints a message to the Serial interface of the Arduino®
IDE when the sensor is touched and makes the built-in LED light up.
The instructions use the Arduino® platform to illustrate product
use. You can also use an Arduino derivative or another platform
that supports this type of product.
Connection
Module S + -
Arduino® 2 5V GND
Code
// Pin for capactitive touch sensor
int ctsPin 2;
// Pin for the LED
int ledPin = 13;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(ctsPin, INPUT);
}
void loop() {
int ctsValue = digitalRead(ctsPin);
if (ctsValue == HIGH){
digitalWrite(ledPin, HIGH);
Serial.println("TOUCHED");
}
else{
digitalWrite(ledPin,LOW);
Serial.println("not touched");
}
delay(500);
}
2