/*
temp lights LM35 and leds
*/
int tempPin = A0;
int a;
const float BETA = 3950;
void setup() {
Serial.begin(9600);
pinMode (2, OUTPUT); //Blue LED symbolising Cold and Not Fit for Consumption
}
void loop() {
int analogValue = analogRead(A0);
float a = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
delay(1000);
if (a>=30) //when temp is between 0-35 degrees
{
digitalWrite(2, HIGH); //blue led is on
}
else {
digitalWrite(2, LOW); //blue led is on
}
Serial.println(a);
}