Catalex Capacitive Touch Sensor (TTP223B) [S009]



https://www.youtube.com/watch?v=ITHiTfEC2CE


*GitHubhttps://github.com/rdiot/rdiot-s009.git



* Specs

This device uses your body as part of the circuit.  When you touch the sensor pad, the capacitance of the circuit is changed and is detected.  That detected change in capacitance results in the output changing states.

When I first got this,  I expected a glitchy device,  that while functional,  would occasionally have unpredictable output results.

I may have been wrong.   After playing for a few hours, I can’t seem to get it to do anything other than what I expected it to do.  If you’re looking for robust user input,  this might do the trick.



* Contents

- Key Code

#define ctsPin 14 // Pin for capactitive touch sensor

 

int ledPin = 13; // pin for the LED

 

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(100);

  

}

Posted by RDIoT

댓글을 달아 주세요