Codey OnlineBiblioteca de componentes Arduino y ESP32 › Touch sensor TTP223B
Touch sensor TTP223B
Sensores

Touch sensor TTP223B

El TTP223B es un circuito integrado sensor táctil capacitivo de un solo canal, usado como sustituto de un botón táctil. Proporciona una salida digital de detección táctil para conexión directa a una entrada de microcontrolador y se usa con frecuencia en interfaces táctiles simples.

Ancho: 27.1 mm

Pinout — Touch sensor TTP223B

Pin Señal Descripción
SIG digital Digital touch-detect output from TTP223B — connect to a microcontroller input
VCC power Positive supply input for the touch sensor module, typically 2.0–5.5V
GND ground Ground reference for the touch sensor module and output signal

Esquema de cableado de ejemplo — Touch sensor TTP223B

Desde Hasta Cable
board:5V x1:VCC red
board:GND x1:GND black
board:D2 x1:SIG green

Código Arduino de ejemplo — Touch sensor TTP223B

Este ejemplo se escribió y verificó por compilación para arduino-uno. Codey Online lo adapta a cualquier otra placa compatible.

const int touchPin = 2;
const int ledPin = 13;

void setup() {
  pinMode(touchPin, INPUT);
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
  while (!Serial) {
    ;
  }
  Serial.println("TTP223B touch sensor example");
}

void loop() {
  int touchState = digitalRead(touchPin);

  digitalWrite(ledPin, touchState);

  Serial.print("Touch state: ");
  if (touchState == HIGH) {
    Serial.println("TOUCHED");
  } else {
    Serial.println("not touched");
  }

  delay(50);
}

Componentes relacionados

18650 Battery Shield with USB-C Charger and 5V Boost Converter

18650 Battery Shield with USB-C Charger and 5V Boost Converter

2.4 inch OLED Display I2C 3.3V

2.4 inch OLED Display I2C 3.3V

3.5 inch TFT LCD Shield

3.5 inch TFT LCD Shield

50kg Load Cell Weight Sensor

50kg Load Cell Weight Sensor

Crea tu proyecto de Arduino o ESP32 con IA

Describe lo que quieres construir. Codey Online escribe el codigo, dibuja el esquema de conexiones, lo compila y graba tu placa directamente desde el navegador.

Empieza gratis