i made code to compare my indoor and outdoor temperature values, when both the temperature values are same i would like to make a beep sound. Problem i face is, often the temperature values are same and i get annoying buzzer sound until the condition mismatch,
i would like to get a single beep when both temperature matches.
the "delay(1000);" used in the code delays my other functions(since the temperature values are changing so fast, i used delay().), i would like to replace delay() with some other which wont delay my other functions...
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
float temp1;
int tempPin1 = 0;
float temp2;
int tempPin2 = 1;
int Buzz = 22;
void setup()
{
lcd.begin(16, 2);
pinMode(Buzz, OUTPUT);
}
void loop()
{
//In Door
temp1 = (3.3 * analogRead(tempPin1) * 100.0) / 1024;
lcd.setCursor(0, 1);
lcd.print(temp1);
lcd.setCursor(0, 0);
lcd.print("In Door|");
lcd.setCursor(5, 1);
lcd.print("*C|");
//Out Door
temp2 = (3.3 * analogRead(tempPin2) * 100.0) / 1024;
lcd.setCursor(8, 1);
lcd.print(temp2);
lcd.setCursor(8, 0);
lcd.print("Out Door");
lcd.setCursor(13, 1);
lcd.print("*C");
//Temp match
if(temp1 = temp2)
{
digitalWrite(Buzz, HIGH);
}
delay(1000);
}
thanks in advance..