Interfacing TTP223 Capacitive Touch Sensor and Arduino Nano

 


Circuit:-

Code:-

int cbutton = 5;
int led = 13;

void setup()  {
  pinMode(led, OUTPUT);
  pinMode(cbutton, INPUT);
  Serial.begin(9600);
}

void loop() {
  int cbuttonval = digitalRead(cbutton);
  if(cbuttonval == HIGH){
    digitalWrite(led, HIGH);
    Serial.println("Touched");
  } else  {
    digitalWrite(led, LOW);
    Serial.println("Not Touched");  
  }
}


Demo:-

 


Comments

Popular Posts