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 |
| A0 | GPIO36 | Optionnel | Entrée analogique (broche ADC) |
| D0 | GPIO17 | Optionnel | Entrée numérique (n'importe quel GPIO) |

Code
Aucune bibliothèque à installer.
int led = 13; // LED output pin
int digitalPin = 2; // KY-028 digital interface
int analogPin = A0; // KY-028 analog interface
int digitalVal; // digital readings
int analogVal; // analog readings
void setup() {
pinMode(led, OUTPUT);
pinMode(digitalPin, INPUT);
Serial.begin(9600);
}
void loop() {
// Read the digital interface
digitalVal = digitalRead(digitalPin);
if (digitalVal == HIGH) { // if temperature threshold reached
digitalWrite(led, HIGH); // turn ON Arduino's LED
} else {
digitalWrite(led, LOW); // turn OFF Arduino's LED
}
// Read the analog interface
analogVal = analogRead(analogPin);
Serial.println(analogVal); // print analog value to serial
delay(100);
}
Brochage
Caractéristiques
Le KY-028 est un module de capteur de température numérique équipé d'une thermistance NTC. Il offre des sorties analogiques et numériques, avec un seuil réglable via un potentiomètre intégré, ce qui le rend idéal pour les applications de surveillance et de contrôle de la température.
| Caractéristique | Valeur |
|---|---|
| Weight | 2 g |
| Dimensions | 36 x 15 x 14 mm |
| Operating Voltage | 3.3V to 5.5V |
| Measurement Accuracy | ±0.5°C |
| Temperature Measurement Range | -55°C to +125°C |

