7
Touch Sensor
TTP223B
Touch Sensor (TTP223B)
No. 7 • Digital

Touch Sensor (TTP223B)

ตรวจจับการสัมผัสแบบ capacitive touch

Component NameTouch Sensor
Part No. / ModelTTP223B
Interface TypeDigital
PinsVCC, I/O, GND

Note: บางรุ่นสามารถตั้งโหมด toggle/momentary ได้จากจุด solder pad

Wiring Example

ตัวอย่างการต่อวงจรกับ Arduino UNO

Circuit diagram
Sensor PinArduino Pin
VCC5V
I/OD2
GNDGND

Arduino IDE Code

Download .ino file

ttp223b-touch.ino
// Touch Sensor (TTP223B)
// Board: Arduino UNO
// Read digital output from the sensor module.

const int SENSOR_PIN = 2;

void setup() {
  Serial.begin(9600);
  pinMode(SENSOR_PIN, INPUT);
}

void loop() {
  int state = digitalRead(SENSOR_PIN);
  Serial.print("Sensor state: ");
  Serial.println(state);
  delay(300);
}