Démarrer
Câblage vers l’ESP32
| Broche du capteur | Broche ESP32 | Statut | Rôle |
|---|---|---|---|
| GND | GND | Requis | Sol |
| +V | 3.3V or 5V | Requis | Alimentation |
| D0 | GPIO15 | Optionnel | Entrée numérique (n'importe quel GPIO) |
| A0 | GPIO34 | Optionnel | Entrée analogique (broche ADC) |

Code
Aucune bibliothèque à installer.
int analog_input = A0; // Analog output of the sensor
int digital_input = 3; // Digital output of the sensor
void setup() {
pinMode(analog_input, INPUT);
pinMode(digital_input, INPUT);
Serial.begin(9600);
Serial.println("KY-036 Touch Recognition");
}
void loop() {
float analog_value = analogRead(analog_input) * (5.0 / 1023.0);
int digital_value = digitalRead(digital_input);
Serial.print("Analog voltage value: ");
Serial.print(analog_value, 4);
Serial.print(" V, Threshold value: ");
if (digital_value == 1) {
Serial.println("reached");
} else {
Serial.println("not yet reached");
}
Serial.println("----------------------------------------------------------------");
delay(1000);
}
Brochage
Caractéristiques
Le KY-036 est un module de capteur tactile métallique qui détecte le toucher via sa pointe métallique, offrant des sorties analogiques et numériques. Avec une sensibilité réglable, il est idéal pour les applications interactives et les commandes tactiles.
| Caractéristique | Valeur |
|---|---|
| Dimensions | 34mm x 16mm |
| Output Type | Analog and Digital |
| Operating Voltage | 3.3V to 5V |
| Sensitivity Adjustment | Via onboard potentiometer |

