// Declare/assign Arduino IO-pins
const int temp_trans_pin = A0, Heater_pin = 13, FAN_pin = 6;
/*FAN_pin: here I used DC motor in stead of FAN because
I couldn't find the symbol for it. Similarly,for the
Heater (Heater_pin), I used LED.*/
// Set the range of the desired temperature
float MaxTemp = 25;/*Room temperature is [20,25] degree C */
// Include the LCD library code
#include <LiquidCrystal.h>
// Initialize the library with the numbers of the interface pins
LiquidCrystal LCD(12, 11, 5, 4, 3, 2);
float temp=0.0;
float procent=0.0;
int potency;
void setup() {
// System initialization
[Link](16, 2);
pinMode(Heater_pin, OUTPUT);//LED in our case
// pinMode(FAN_pin, OUTPUT);
// Display the desired range of temperature
[Link]("Room temp(C):");
[Link](2,1);
//[Link](MinTemp); [Link]("-");[Link](MaxTemp);
delay(2000);
}
void loop() {
float Eqv_volt, SensorTemp;
int analog_value = analogRead(A1);
temp = (analog_value * 5.0) / 1023.0;
procent = temp*20;
potency = map(analogRead(A2), 0, 1023, 0, 270);
Eqv_volt = analogRead(temp_trans_pin) * 5.0 / 1023;
SensorTemp = 100.0 * Eqv_volt-50.0;
// Display the sensor reading
/*Compare the sensor reading with the range of
acceptable temperatures*/
if(SensorTemp > MaxTemp){
digitalWrite(Heater_pin, LOW);
[Link]();
[Link]("High T!");//higher than the max
[Link](11,0);
[Link]("Set T");
[Link](13,1);
[Link]("25");
[Link]("v%");
[Link](temp);
[Link](6, 0);
[Link]("V% ");
[Link](5, 1);
[Link](procent);
[Link]("%");
delay(4000);
delay(4000);
}
else if(SensorTemp < MaxTemp){
[Link]();
[Link]("Low T");//Less than the mini
[Link](0, 1);
[Link]("H On");
[Link](11,0);
[Link]("Set T");
[Link](13,1);
[Link]("25");
[Link]("v%");
[Link](temp);
[Link](6, 0);
[Link]("V% ");
[Link](5, 1);
[Link](procent);
[Link]("%");
delay(4000);
//Turn the heater ON, LED in our case
digitalWrite(Heater_pin, HIGH);
delay(4000);
}
}