Thank you so much for your help. I appreciate it a lot. Although I’m not yet done, I can now visualize the course of this project. Any help further will be much appreciated. So far, my codes are working according to my choice. The only problem is that, I dont know the limits of the piezo buzzer’s frequency. But I think it is re-searchable. I still accepts help from you guys. haha

```
int val;
int tempPin = 1;
const int buzzer = 9;
void setup()
{
Serial.begin(9600);
pinMode(buzzer, OUTPUT);
}
void loop()
{
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000;
float cel = mv/10;
Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
delay(1000);
if (cel <= 29){
tone(buzzer, 200, 500);
delay(1000);
noTone(buzzer);
delay(1000);
}
else if (cel <= 28){
tone(buzzer, 500, 500);
delay(1000);
noTone(buzzer);
delay(1000);
}
else if (cel <= 27){
tone(buzzer, 700, 500);
delay(1000);
noTone(buzzer);
delay(1000);
}
else if (cel <= 26){
tone(buzzer, 900, 500);
delay(1000);
noTone(buzzer);
delay(1000);
}
else if (cel <= 25){
tone(buzzer, 1000, 500);
}
}
```

I changed those “==” with “<=” like that “sieve-method” of Mr. Koepel and adwsystems. Thanks a lot guys

adwsystems:

That’s a good change. You changed the equation from set cel to a value to check if it is equal to a value.

Your cel if statements have to problems. They are only true if cel is equal to the singular value. What happens is cel = 25.1? Nothing. Luckily as as Koepel alluded, a float cannot be tested to be equal to number. The float data type must be tested to see if the variable is within a range. If you want to test for 25, then cel must be >= 25 and also < 26. You can then carry method through the tests for 26, 27, 28 and 29.

Koepel:

You can convert the temperature into an integer. An integer can only be a whole number, for example: 25, 26, 27, 28.

A variable that is a ‘float’ is (almost) never a certain number. You can not compare it with a number.

Do you know the “sieve” method ?

Start with a course sieve, then a finer sieve, then a more finer sieve, and so on.

See the temperature as a stone, and higher temperatures are bigger stones. They will fall down the “if … else if … else if” structure into finer and finer sieves.

**Sieve with a 'float’**

```
float x;
```

if ( x >= 100.0 )

{

// x is 100 or above it

}

else if ( x >= 90.0 )

{

// x is between 90 and 100

}

else if ( x >= 80.0 )

{

// x is between 80 and 90

}

else

{

// x is below 80

}

```
**Sieve with a 'int'**:
```

int n;

if ( n >= 100 )

{

// n is 100 or above it

}

else if ( n >= 90 )

{

// n is between 90 (inclusive) and 100

}

else if ( n >= 80 )

{

// n is between 80 (inclusive) and 90

}

else

{

// x is below 80

}

```
I'm not sure if this is called the "sieve-method" in English, but that is what it is called in my country.
```