Touch Module

$4.85

20 in stock

Description

Touch Sensor Module Code


/* SETUP

Touch Sensor    Arduino
VCC       -     5V
GND       -     GND
SIG       -     D3
*/
 
int TouchSensor = 3;    //connected to digital pin D3
int led = 13;
void setup(){
Serial.begin(9600);   // communication speed
  pinMode(led, OUTPUT);
  pinMode(TouchSensor, INPUT);
}

void loop(){
  if(digitalRead(TouchSensor)==HIGH)    //read touch sensor signal
   { 
    digitalWrite(led, HIGH);    // if touch sensor is HIGH, then turn on led
    Serial.println("1");
   }
  else
   {
    digitalWrite(led, LOW);   // if touch sensor is LOW, then turn off the led
    Serial.println("0");
   }
  delay(50);    // Slow down the output for easier read

Additional information

Weight 0.003 kg

There are no reviews yet.

Be the first to review “Touch Module”

Your email address will not be published. Required fields are marked *