final_code

Dependencies:   mbed

Committer:
amirgahroosi
Date:
Wed Dec 10 16:48:21 2014 +0000
Revision:
0:7208cb44ad05
Microcontrollers and their applications project;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
amirgahroosi 0:7208cb44ad05 1 #include "mbed.h"
amirgahroosi 0:7208cb44ad05 2 #include "airhumidity.h"
amirgahroosi 0:7208cb44ad05 3 #include <string>
amirgahroosi 0:7208cb44ad05 4
amirgahroosi 0:7208cb44ad05 5 DigitalOut myled(LED1);
amirgahroosi 0:7208cb44ad05 6 Serial pc(USBTX, USBRX); // tx, rx
amirgahroosi 0:7208cb44ad05 7 Serial bt(PTE22, PTE23); // initializing Uart1 channel for connecting the bluetooth device
amirgahroosi 0:7208cb44ad05 8 AnalogIn gas_output(PTB1); //initializing the ADC output for gas sensor
amirgahroosi 0:7208cb44ad05 9
amirgahroosi 0:7208cb44ad05 10 using namespace std;
amirgahroosi 0:7208cb44ad05 11
amirgahroosi 0:7208cb44ad05 12 DigitalOut R1 (D6);
amirgahroosi 0:7208cb44ad05 13 DigitalOut R2 (D7);
amirgahroosi 0:7208cb44ad05 14 DigitalOut R3 (D8);
amirgahroosi 0:7208cb44ad05 15 DigitalOut R4 (D9);
amirgahroosi 0:7208cb44ad05 16
amirgahroosi 0:7208cb44ad05 17 InterruptIn C1 (D10);
amirgahroosi 0:7208cb44ad05 18 DigitalIn C2 (D11);
amirgahroosi 0:7208cb44ad05 19 DigitalIn C3 (D12);
amirgahroosi 0:7208cb44ad05 20
amirgahroosi 0:7208cb44ad05 21 DigitalOut keyled(LED1);
amirgahroosi 0:7208cb44ad05 22 DigitalOut flash(LED4);
amirgahroosi 0:7208cb44ad05 23
amirgahroosi 0:7208cb44ad05 24 AnalogIn ain(PTB0);
amirgahroosi 0:7208cb44ad05 25
amirgahroosi 0:7208cb44ad05 26 Timer t;
amirgahroosi 0:7208cb44ad05 27 float tm ;
amirgahroosi 0:7208cb44ad05 28
amirgahroosi 0:7208cb44ad05 29 char key;
amirgahroosi 0:7208cb44ad05 30 int s=0;
amirgahroosi 0:7208cb44ad05 31
amirgahroosi 0:7208cb44ad05 32 float value_adc =0.0f;
amirgahroosi 0:7208cb44ad05 33 int dig_value = 0;
amirgahroosi 0:7208cb44ad05 34 Timer timeout;
amirgahroosi 0:7208cb44ad05 35 float current_time = 0.0;
amirgahroosi 0:7208cb44ad05 36
amirgahroosi 0:7208cb44ad05 37 unsigned char arrkey[12]={ '1' , '2' , '3' ,
amirgahroosi 0:7208cb44ad05 38 '4' , '5' , '6' ,
amirgahroosi 0:7208cb44ad05 39 '7' , '8' , '9' ,
amirgahroosi 0:7208cb44ad05 40 '*' , '0' , '#' };
amirgahroosi 0:7208cb44ad05 41
amirgahroosi 0:7208cb44ad05 42 char msg;
amirgahroosi 0:7208cb44ad05 43 float temp=0.0;
amirgahroosi 0:7208cb44ad05 44 float humid=0.0;
amirgahroosi 0:7208cb44ad05 45 int unit =0;
amirgahroosi 0:7208cb44ad05 46 string room_safety_status = "issafe";
amirgahroosi 0:7208cb44ad05 47 bool room_safe = true;
amirgahroosi 0:7208cb44ad05 48 bool someone_in = false;
amirgahroosi 0:7208cb44ad05 49 bool door_lock_status = true;
amirgahroosi 0:7208cb44ad05 50 string is_door_locked = "locked";
amirgahroosi 0:7208cb44ad05 51 string room_status = "yes";
amirgahroosi 0:7208cb44ad05 52 string room_gas_status = "safe";
amirgahroosi 0:7208cb44ad05 53 float gas_sensor_value = 0.0;
amirgahroosi 0:7208cb44ad05 54
amirgahroosi 0:7208cb44ad05 55 bool allow_entrance = false;
amirgahroosi 0:7208cb44ad05 56 bool authorized_person_entered = false;
amirgahroosi 0:7208cb44ad05 57 bool authorized_person_left = true;
amirgahroosi 0:7208cb44ad05 58 string last_person = "N/A";
amirgahroosi 0:7208cb44ad05 59
amirgahroosi 0:7208cb44ad05 60
amirgahroosi 0:7208cb44ad05 61 void unlock (){
amirgahroosi 0:7208cb44ad05 62 printf("DOOR UNLOCK: Welcome!\n\r");
amirgahroosi 0:7208cb44ad05 63 door_lock_status = false;
amirgahroosi 0:7208cb44ad05 64 }
amirgahroosi 0:7208cb44ad05 65
amirgahroosi 0:7208cb44ad05 66 void lock (){
amirgahroosi 0:7208cb44ad05 67 printf("DOOR LOCK\n\r");
amirgahroosi 0:7208cb44ad05 68 door_lock_status = true;
amirgahroosi 0:7208cb44ad05 69 }
amirgahroosi 0:7208cb44ad05 70
amirgahroosi 0:7208cb44ad05 71 unsigned char char_string[4]= {'*' ,'*' ,'*' ,'*'};
amirgahroosi 0:7208cb44ad05 72 unsigned char password[4]={'1' , '2' , '3' , '4'};
amirgahroosi 0:7208cb44ad05 73 unsigned char passwordA[4]={'4' , '5' , '6' , '7'};
amirgahroosi 0:7208cb44ad05 74
amirgahroosi 0:7208cb44ad05 75 unsigned char keypad(){
amirgahroosi 0:7208cb44ad05 76 unsigned char r,b;
amirgahroosi 0:7208cb44ad05 77
amirgahroosi 0:7208cb44ad05 78 while(current_time<5){
amirgahroosi 0:7208cb44ad05 79 current_time = timeout.read();
amirgahroosi 0:7208cb44ad05 80 for (r=0; r<4; r++){
amirgahroosi 0:7208cb44ad05 81 b=4;
amirgahroosi 0:7208cb44ad05 82 R1 = 1; R2 = 1 ; R3 = 1 ; R4 = 1;
amirgahroosi 0:7208cb44ad05 83 if (r == 0) R1 = 0;
amirgahroosi 0:7208cb44ad05 84 if (r == 1) R2 = 0;
amirgahroosi 0:7208cb44ad05 85 if (r == 2) R3 = 0;
amirgahroosi 0:7208cb44ad05 86 if (r == 3) R4 = 0;
amirgahroosi 0:7208cb44ad05 87
amirgahroosi 0:7208cb44ad05 88 if(C1==0) b=0;
amirgahroosi 0:7208cb44ad05 89 if(C2==0) b=1;
amirgahroosi 0:7208cb44ad05 90 if(C3==0) b=2;
amirgahroosi 0:7208cb44ad05 91
amirgahroosi 0:7208cb44ad05 92 if ((!(b==4))){
amirgahroosi 0:7208cb44ad05 93 key=arrkey[(r*3)+b];
amirgahroosi 0:7208cb44ad05 94 while(C1==0);
amirgahroosi 0:7208cb44ad05 95 while(C2==0);
amirgahroosi 0:7208cb44ad05 96 while(C3==0);
amirgahroosi 0:7208cb44ad05 97
amirgahroosi 0:7208cb44ad05 98 wait(0.2);
amirgahroosi 0:7208cb44ad05 99
amirgahroosi 0:7208cb44ad05 100 char_string[s] = key;
amirgahroosi 0:7208cb44ad05 101 s++;
amirgahroosi 0:7208cb44ad05 102 return key;
amirgahroosi 0:7208cb44ad05 103 }
amirgahroosi 0:7208cb44ad05 104
amirgahroosi 0:7208cb44ad05 105 }
amirgahroosi 0:7208cb44ad05 106 }
amirgahroosi 0:7208cb44ad05 107 return 'Q';
amirgahroosi 0:7208cb44ad05 108 }
amirgahroosi 0:7208cb44ad05 109
amirgahroosi 0:7208cb44ad05 110 void handleKeypad (){
amirgahroosi 0:7208cb44ad05 111
amirgahroosi 0:7208cb44ad05 112 bool finished = false ;
amirgahroosi 0:7208cb44ad05 113 printf("In Intruppt\n\r");
amirgahroosi 0:7208cb44ad05 114 __disable_irq();
amirgahroosi 0:7208cb44ad05 115 C1.disable_irq ();
amirgahroosi 0:7208cb44ad05 116
amirgahroosi 0:7208cb44ad05 117 int firsttime = 0;
amirgahroosi 0:7208cb44ad05 118
amirgahroosi 0:7208cb44ad05 119 if (firsttime == 0)
amirgahroosi 0:7208cb44ad05 120 {
amirgahroosi 0:7208cb44ad05 121 s = -1;
amirgahroosi 0:7208cb44ad05 122 timeout.reset();
amirgahroosi 0:7208cb44ad05 123 timeout.start();
amirgahroosi 0:7208cb44ad05 124 }
amirgahroosi 0:7208cb44ad05 125
amirgahroosi 0:7208cb44ad05 126 current_time = timeout.read();
amirgahroosi 0:7208cb44ad05 127
amirgahroosi 0:7208cb44ad05 128 while ((! finished) && (current_time < 5.0)){
amirgahroosi 0:7208cb44ad05 129 key = keypad();
amirgahroosi 0:7208cb44ad05 130 current_time = timeout.read();
amirgahroosi 0:7208cb44ad05 131 if (s == 4){
amirgahroosi 0:7208cb44ad05 132 finished = true;
amirgahroosi 0:7208cb44ad05 133 firsttime = 1;
amirgahroosi 0:7208cb44ad05 134
amirgahroosi 0:7208cb44ad05 135 printf("Password: ");
amirgahroosi 0:7208cb44ad05 136 for (int i = 0 ; i < 4 ; i++)
amirgahroosi 0:7208cb44ad05 137 printf("%c", char_string[i]);
amirgahroosi 0:7208cb44ad05 138 printf("\n\r");
amirgahroosi 0:7208cb44ad05 139 s = 0;
amirgahroosi 0:7208cb44ad05 140 /////////////check password functions//////////
amirgahroosi 0:7208cb44ad05 141 int j = 0;
amirgahroosi 0:7208cb44ad05 142 int matchSara = 1;
amirgahroosi 0:7208cb44ad05 143 while (j < 4){
amirgahroosi 0:7208cb44ad05 144 if (char_string [j] == password[j])
amirgahroosi 0:7208cb44ad05 145 j++;
amirgahroosi 0:7208cb44ad05 146 else{
amirgahroosi 0:7208cb44ad05 147 matchSara = 0;
amirgahroosi 0:7208cb44ad05 148 break;
amirgahroosi 0:7208cb44ad05 149 }
amirgahroosi 0:7208cb44ad05 150 if(matchSara && j == 3)
amirgahroosi 0:7208cb44ad05 151 {
amirgahroosi 0:7208cb44ad05 152 last_person = "Sara";
amirgahroosi 0:7208cb44ad05 153 allow_entrance = true;
amirgahroosi 0:7208cb44ad05 154 door_lock_status = false;
amirgahroosi 0:7208cb44ad05 155 room_safety_status = "issafe";
amirgahroosi 0:7208cb44ad05 156 room_safe = true;
amirgahroosi 0:7208cb44ad05 157 }
amirgahroosi 0:7208cb44ad05 158 }
amirgahroosi 0:7208cb44ad05 159
amirgahroosi 0:7208cb44ad05 160 int k = 0;
amirgahroosi 0:7208cb44ad05 161 int matchAmir = 1;
amirgahroosi 0:7208cb44ad05 162 while (k < 4){
amirgahroosi 0:7208cb44ad05 163 if (char_string [k] == passwordA[k])
amirgahroosi 0:7208cb44ad05 164 k++;
amirgahroosi 0:7208cb44ad05 165 else{
amirgahroosi 0:7208cb44ad05 166 matchAmir = 0;
amirgahroosi 0:7208cb44ad05 167 break;
amirgahroosi 0:7208cb44ad05 168 }
amirgahroosi 0:7208cb44ad05 169 if(matchAmir && k == 3)
amirgahroosi 0:7208cb44ad05 170 {
amirgahroosi 0:7208cb44ad05 171 last_person = "Amir";
amirgahroosi 0:7208cb44ad05 172 allow_entrance = true;
amirgahroosi 0:7208cb44ad05 173 door_lock_status = false;
amirgahroosi 0:7208cb44ad05 174 room_safety_status = "issafe";
amirgahroosi 0:7208cb44ad05 175 room_safe = true;
amirgahroosi 0:7208cb44ad05 176 }
amirgahroosi 0:7208cb44ad05 177 }
amirgahroosi 0:7208cb44ad05 178
amirgahroosi 0:7208cb44ad05 179 if (matchSara == 1){
amirgahroosi 0:7208cb44ad05 180 printf("MATCH Sara\n\r");
amirgahroosi 0:7208cb44ad05 181 room_safety_status = "issafe";
amirgahroosi 0:7208cb44ad05 182 room_safe = true;
amirgahroosi 0:7208cb44ad05 183 unlock();
amirgahroosi 0:7208cb44ad05 184 C1.enable_irq();
amirgahroosi 0:7208cb44ad05 185 __enable_irq();
amirgahroosi 0:7208cb44ad05 186 break;
amirgahroosi 0:7208cb44ad05 187 }
amirgahroosi 0:7208cb44ad05 188 else if (matchAmir == 1){
amirgahroosi 0:7208cb44ad05 189 printf("MATCH Amir\n\r");
amirgahroosi 0:7208cb44ad05 190 room_safety_status = "issafe";
amirgahroosi 0:7208cb44ad05 191 room_safe = true;
amirgahroosi 0:7208cb44ad05 192 unlock();
amirgahroosi 0:7208cb44ad05 193 C1.enable_irq();
amirgahroosi 0:7208cb44ad05 194 __enable_irq();
amirgahroosi 0:7208cb44ad05 195 break;
amirgahroosi 0:7208cb44ad05 196 }
amirgahroosi 0:7208cb44ad05 197 else{
amirgahroosi 0:7208cb44ad05 198 printf("WRONG\n\r");
amirgahroosi 0:7208cb44ad05 199 printf("lock for wrong password\n\r");
amirgahroosi 0:7208cb44ad05 200 C1.enable_irq();
amirgahroosi 0:7208cb44ad05 201 __enable_irq();
amirgahroosi 0:7208cb44ad05 202 break;
amirgahroosi 0:7208cb44ad05 203 }
amirgahroosi 0:7208cb44ad05 204 } // end s=4
amirgahroosi 0:7208cb44ad05 205 } //end while
amirgahroosi 0:7208cb44ad05 206 timeout.stop();
amirgahroosi 0:7208cb44ad05 207 C1.enable_irq ();
amirgahroosi 0:7208cb44ad05 208 __enable_irq();
amirgahroosi 0:7208cb44ad05 209 }
amirgahroosi 0:7208cb44ad05 210
amirgahroosi 0:7208cb44ad05 211
amirgahroosi 0:7208cb44ad05 212 void uart_interrupt_fun() {
amirgahroosi 0:7208cb44ad05 213 __disable_irq();
amirgahroosi 0:7208cb44ad05 214 msg = bt.getc();
amirgahroosi 0:7208cb44ad05 215 //pc.putc(msg);
amirgahroosi 0:7208cb44ad05 216 if(msg == 's'){
amirgahroosi 0:7208cb44ad05 217 msg = 'n';
amirgahroosi 0:7208cb44ad05 218 wait(1);
amirgahroosi 0:7208cb44ad05 219 //pc.printf(" \n\r") ;
amirgahroosi 0:7208cb44ad05 220 bt.printf("info %4.2f %4.2f %s %s %s %s %s end\n\r", temp, humid, room_status,room_gas_status, room_safety_status, last_person, is_door_locked) ;
amirgahroosi 0:7208cb44ad05 221 wait(3);
amirgahroosi 0:7208cb44ad05 222 for(int i=0; i<2; i++)
amirgahroosi 0:7208cb44ad05 223 {
amirgahroosi 0:7208cb44ad05 224 myled = 1;
amirgahroosi 0:7208cb44ad05 225 wait(0.2);
amirgahroosi 0:7208cb44ad05 226 myled = 0;
amirgahroosi 0:7208cb44ad05 227 wait(0.2);
amirgahroosi 0:7208cb44ad05 228 }
amirgahroosi 0:7208cb44ad05 229
amirgahroosi 0:7208cb44ad05 230 }
amirgahroosi 0:7208cb44ad05 231 __enable_irq();
amirgahroosi 0:7208cb44ad05 232
amirgahroosi 0:7208cb44ad05 233 }
amirgahroosi 0:7208cb44ad05 234
amirgahroosi 0:7208cb44ad05 235 void check_rooms_presence_safety()
amirgahroosi 0:7208cb44ad05 236 {
amirgahroosi 0:7208cb44ad05 237 if(someone_in)
amirgahroosi 0:7208cb44ad05 238 {
amirgahroosi 0:7208cb44ad05 239 if( !door_lock_status )
amirgahroosi 0:7208cb44ad05 240 {
amirgahroosi 0:7208cb44ad05 241
amirgahroosi 0:7208cb44ad05 242 room_safety_status = "issafe";
amirgahroosi 0:7208cb44ad05 243 room_safe = true;
amirgahroosi 0:7208cb44ad05 244 authorized_person_entered = true;
amirgahroosi 0:7208cb44ad05 245 if(authorized_person_entered)
amirgahroosi 0:7208cb44ad05 246 {
amirgahroosi 0:7208cb44ad05 247 door_lock_status = true;
amirgahroosi 0:7208cb44ad05 248 }
amirgahroosi 0:7208cb44ad05 249 }
amirgahroosi 0:7208cb44ad05 250 else /*if(!authorized_person_entered || authorized_person_left) */
amirgahroosi 0:7208cb44ad05 251 {
amirgahroosi 0:7208cb44ad05 252 room_safety_status = "notsafe";
amirgahroosi 0:7208cb44ad05 253 room_safe = false;
amirgahroosi 0:7208cb44ad05 254 }
amirgahroosi 0:7208cb44ad05 255 }
amirgahroosi 0:7208cb44ad05 256 if(! someone_in)
amirgahroosi 0:7208cb44ad05 257 {
amirgahroosi 0:7208cb44ad05 258 if(authorized_person_entered)
amirgahroosi 0:7208cb44ad05 259 {
amirgahroosi 0:7208cb44ad05 260 authorized_person_left = true;
amirgahroosi 0:7208cb44ad05 261 authorized_person_entered = false;
amirgahroosi 0:7208cb44ad05 262 allow_entrance = false;
amirgahroosi 0:7208cb44ad05 263 door_lock_status = true;
amirgahroosi 0:7208cb44ad05 264 room_safety_status = "issafe";
amirgahroosi 0:7208cb44ad05 265 room_safe = true;
amirgahroosi 0:7208cb44ad05 266 }
amirgahroosi 0:7208cb44ad05 267 if(!authorized_person_entered && !(door_lock_status))
amirgahroosi 0:7208cb44ad05 268 {
amirgahroosi 0:7208cb44ad05 269 door_lock_status = false;
amirgahroosi 0:7208cb44ad05 270 }
amirgahroosi 0:7208cb44ad05 271 if(!room_safe)
amirgahroosi 0:7208cb44ad05 272 {
amirgahroosi 0:7208cb44ad05 273 room_safety_status = "notsafe";
amirgahroosi 0:7208cb44ad05 274 }
amirgahroosi 0:7208cb44ad05 275
amirgahroosi 0:7208cb44ad05 276 }
amirgahroosi 0:7208cb44ad05 277
amirgahroosi 0:7208cb44ad05 278 }
amirgahroosi 0:7208cb44ad05 279
amirgahroosi 0:7208cb44ad05 280 const char * gas_status_function()
amirgahroosi 0:7208cb44ad05 281 {
amirgahroosi 0:7208cb44ad05 282 if(gas_sensor_value < 45)
amirgahroosi 0:7208cb44ad05 283 {
amirgahroosi 0:7208cb44ad05 284 return "safe";
amirgahroosi 0:7208cb44ad05 285 }
amirgahroosi 0:7208cb44ad05 286 else
amirgahroosi 0:7208cb44ad05 287 {
amirgahroosi 0:7208cb44ad05 288 return "danger";
amirgahroosi 0:7208cb44ad05 289 }
amirgahroosi 0:7208cb44ad05 290 return "notvalid";
amirgahroosi 0:7208cb44ad05 291 }
amirgahroosi 0:7208cb44ad05 292
amirgahroosi 0:7208cb44ad05 293 void PIR_status_function()
amirgahroosi 0:7208cb44ad05 294 {
amirgahroosi 0:7208cb44ad05 295 if (value_adc < 0.2)
amirgahroosi 0:7208cb44ad05 296 {
amirgahroosi 0:7208cb44ad05 297 //printf("Nobody is here!\n\r");
amirgahroosi 0:7208cb44ad05 298 someone_in = false;
amirgahroosi 0:7208cb44ad05 299 }
amirgahroosi 0:7208cb44ad05 300 else {
amirgahroosi 0:7208cb44ad05 301 //printf("Somebody is here!\n\r");
amirgahroosi 0:7208cb44ad05 302 someone_in = true;
amirgahroosi 0:7208cb44ad05 303 }
amirgahroosi 0:7208cb44ad05 304 }
amirgahroosi 0:7208cb44ad05 305
amirgahroosi 0:7208cb44ad05 306
amirgahroosi 0:7208cb44ad05 307 const char * change_room_status_string()
amirgahroosi 0:7208cb44ad05 308 {
amirgahroosi 0:7208cb44ad05 309 if(someone_in)
amirgahroosi 0:7208cb44ad05 310 {
amirgahroosi 0:7208cb44ad05 311 return "yes";
amirgahroosi 0:7208cb44ad05 312 }
amirgahroosi 0:7208cb44ad05 313 else
amirgahroosi 0:7208cb44ad05 314 {
amirgahroosi 0:7208cb44ad05 315 return "no";
amirgahroosi 0:7208cb44ad05 316 }
amirgahroosi 0:7208cb44ad05 317 }
amirgahroosi 0:7208cb44ad05 318
amirgahroosi 0:7208cb44ad05 319 const char * door_lock_status_func()
amirgahroosi 0:7208cb44ad05 320 {
amirgahroosi 0:7208cb44ad05 321 if(door_lock_status)
amirgahroosi 0:7208cb44ad05 322 {
amirgahroosi 0:7208cb44ad05 323 return "lock";
amirgahroosi 0:7208cb44ad05 324 }
amirgahroosi 0:7208cb44ad05 325 else
amirgahroosi 0:7208cb44ad05 326 {
amirgahroosi 0:7208cb44ad05 327 return "unlock";
amirgahroosi 0:7208cb44ad05 328 }
amirgahroosi 0:7208cb44ad05 329 }
amirgahroosi 0:7208cb44ad05 330
amirgahroosi 0:7208cb44ad05 331 void print_data_uart0()
amirgahroosi 0:7208cb44ad05 332 {
amirgahroosi 0:7208cb44ad05 333 printf("Temperature is %4.2f C \r\n",temp);
amirgahroosi 0:7208cb44ad05 334 printf("Humid is %4.2f \r\n",humid);
amirgahroosi 0:7208cb44ad05 335 printf("Presence: %s \r\n",room_status);
amirgahroosi 0:7208cb44ad05 336 printf("gas: %f\r\n", gas_sensor_value);
amirgahroosi 0:7208cb44ad05 337 printf("room safety: %s\r\n",room_safety_status);
amirgahroosi 0:7208cb44ad05 338 printf("door lock status %s\n\r", is_door_locked);
amirgahroosi 0:7208cb44ad05 339 printf("Analog %5.2f\n\r",value_adc);
amirgahroosi 0:7208cb44ad05 340 }
amirgahroosi 0:7208cb44ad05 341
amirgahroosi 0:7208cb44ad05 342
amirgahroosi 0:7208cb44ad05 343 int main() {
amirgahroosi 0:7208cb44ad05 344
amirgahroosi 0:7208cb44ad05 345 while(1){
amirgahroosi 0:7208cb44ad05 346
amirgahroosi 0:7208cb44ad05 347 bt.baud(38400);
amirgahroosi 0:7208cb44ad05 348 bt.attach(&uart_interrupt_fun);
amirgahroosi 0:7208cb44ad05 349
amirgahroosi 0:7208cb44ad05 350 R4 = 0;
amirgahroosi 0:7208cb44ad05 351 C1.fall(&handleKeypad);
amirgahroosi 0:7208cb44ad05 352
amirgahroosi 0:7208cb44ad05 353 temp = get_air_temp_inside(unit);
amirgahroosi 0:7208cb44ad05 354 humid = get_air_humid_inside();
amirgahroosi 0:7208cb44ad05 355 value_adc = ain.read();
amirgahroosi 0:7208cb44ad05 356 gas_sensor_value = gas_output.read()*50;
amirgahroosi 0:7208cb44ad05 357 check_rooms_presence_safety();
amirgahroosi 0:7208cb44ad05 358 room_gas_status = gas_status_function();
amirgahroosi 0:7208cb44ad05 359 PIR_status_function();
amirgahroosi 0:7208cb44ad05 360 room_status = change_room_status_string();
amirgahroosi 0:7208cb44ad05 361 is_door_locked = door_lock_status_func();
amirgahroosi 0:7208cb44ad05 362 print_data_uart0();
amirgahroosi 0:7208cb44ad05 363 }
amirgahroosi 0:7208cb44ad05 364 }