-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwarm_blanket.ino
76 lines (73 loc) · 2.04 KB
/
warm_blanket.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//to input the test temperature, display it and as well as display the increasing temperatures.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
const int sensor=A0;
int sensor_temp;
int temp=1;
int relay=9;
/*int pump=10;
char Tempc;
String temp_S="";
char octaKeys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {1,2,3,4};
byte colPins[COLS] = {5,6,7,8};
Keypad customKeypad = Keypad(makeKeymap(octaKeys), rowPins, colPins, ROWS, COLS); //mapping my whole keypad
LiquidCrystal_I2C lcd(0x21, 16, 2); */
void setup(){
digitalWrite(sensor, INPUT);
//lcd.backlight();
//lcd.init();
digitalWrite(relay,LOW);
Serial.begin(9600);
}
void loop()
{
Serial.println("HEy there1!");
/*while(Tempc!='C') //only made in centigradfe. can give them farenheit facility too. discuss.
{
Tempc = customKeypad.getKey();
temp=(temp*10)+atoi(Tempc);
temp_S+=Tempc;
if (Tempc){
lcd.clear(); //clear screening
lcd.setCursor(0, 0);
lcd.print(Tempc); //displaying inputted temperature
}
}*/
//temp=temp_S.toFloat();
digitalWrite(relay,HIGH);
delay(100);
//Serial.println(" Stopping temperature is: "+temp);//integer stopping temperature
//after this lcd will display the sensor read temperatures
Serial.println("HEy there!");
float vout=analogRead(sensor); //Reading the value from sensor
vout=(vout*500)/1023;
sensor_temp= vout; //conversion to temp Celsius
Serial.print(sensor_temp);
Serial.println(" degree centigrade");
delay(500);
if(sensor_temp==(temp)) //assuming temperature loss is 5
{
//digitalWrite(relay,LOW);
//igitalWrite(pump, HIGH);
Serial.println("PUMP IS STARTING TO WORK ARDUINO DID IT'S WORK");
delay(10000);
}
/*else
{
Serial.print("Temperature= ");
Serial.println(temp);
lcd.setCursor(0,0);
lcd.print("TEMP= ");
lcd.print(sensor_temp);
lcd.print(" C");
}*/
}