const int tempPin = A0;
const int buzzerPin = 8;
const float thresholdTemp = 69.0;
void setup() {
pinMode(tempPin, INPUT);
pinMode(buzzerPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int analogValue = analogRead(tempPin);
float voltage = analogValue * (5.0 / 1023.0);
float tempC = voltage * 100.0;
float tempF = tempC * 9.0 / 5.0 + 32.0;
Serial.print("Temperature: ");
Serial.print(tempF);
Serial.println(" F");
if (tempF >= thresholdTemp) {
digitalWrite(buzzerPin, HIGH);
} else {
digitalWrite(buzzerPin, LOW);
}
delay(1000);
}