#include <Toggle.h>
const byte potPin = A0; // Broche analogique pour le Pot
const byte buttonPin = 2; // Broche pour le bouton poussoir
Toggle bouton;
void announceTemperature() {
int sensorValue = analogRead(potPin);
float temperature = (sensorValue * 5.0 / 1023.0) * 100.0;
int integerPart = temperature;
int decimalPart = (temperature - integerPart) * 10.0;
Serial.print(integerPart + 1);
Serial.print(" POINT "); // "point"
Serial.print(decimalPart + 1);
Serial.println(" degré Celsius");
}
void setup() {
bouton.begin(buttonPin);
Serial.begin(115200);
}
void loop() {
bouton.poll();
if (bouton.onPress()) announceTemperature();
}