Weekend Project : Smart Society
This project focuses on making societies smarter and secure by using the amazing capabilities of Arduino.
Components and supplies
water pump
expansion shield or breadboard
HC-05 Bluetooth Module
Alphanumeric LCD, 16 x 2
Laser Diode, 655 nm
SparkFun RedBot Sensor - Line Follower
LED, RGB
Relay Module (Generic)
Jumper wires (generic)
LDR, 5 Mohm
SG90 Micro-servo motor
RFID reader (generic)
SparkFun Soil Moisture Sensor (with Screw Terminals)
Tools and machines
Mirrors for reflecting light
Tape, Clear
Apps and platforms
Arduino IDE
Project description
Code
Code of the project
c_cpp
*remove the rx pin of HC 05 before uploading the code
1#include <SPI.h> 2#include <MFRC522.h> 3#include <Servo.h> 4#include <Wire.h> 5#include <LiquidCrystal_I2C.h> 6 7 LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); 8 9#define SS_PIN 10 10#define RST_PIN 9 11#define LED_G 5 //define green LED pin 12#define LED_R 4 //define red LED 13#define BUZZER 2 //buzzer pin 14MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. 15int x; 16int y; 17int z; 18int pushButton = 2; 19boolean park = false; 20int redPin = 7; // R petal on RGB LED module connected to digital pin 11 21int greenPin = 8; // G petal on RGB LED module connected to digital pin 9 22int bluePin = 6; 23Servo myServo; //define servo name 24 25void setup() 26{ 27 Serial.begin(9600); 28 lcd.begin(16, 2); // Initiate a serial communication 29 SPI.begin(); // Initiate SPI bus 30 mfrc522.PCD_Init(); // Initiate MFRC522 31 myServo.attach(3); //servo pin 32 myServo.write(50); //servo start position 33 pinMode(LED_G, OUTPUT); 34 pinMode(LED_R, OUTPUT); 35 pinMode(BUZZER, OUTPUT); 36 pinMode(redPin, OUTPUT); // sets the redPin to be an output 37 pinMode(greenPin, OUTPUT); // sets the greenPin to be an output 38 pinMode(bluePin, OUTPUT); 39// pinMode(5, OUTPUT); 40 41 // make the pushbutton's pin an input: 42 pinMode(pushButton, INPUT); 43 pinMode(4, OUTPUT); 44 noTone(BUZZER); 45 pinMode(A0,INPUT); 46 pinMode(A1,INPUT); 47 Serial.println("Put your card to the reader..."); 48 Serial.println(); 49 50} 51void loop() 52{ 53 if (Serial.available() > 0) 54 { 55 int data = Serial.read(); 56 57 Serial.println(data); 58 59 switch (data) 60 61 { 62 case 66: 63 Serial.println("data2"); 64 digitalWrite(redPin,HIGH); 65 break; 66 67 case 65: 68 Serial.println("data1"); 69 digitalWrite(redPin,LOW); 70 digitalWrite(bluePin,LOW); 71 digitalWrite(greenPin,LOW); 72 break; 73 74 case 67: 75 digitalWrite(bluePin,HIGH); 76 break; 77 78 case 68: 79 digitalWrite(greenPin,HIGH); 80 break; 81 82 case 69: 83 digitalWrite(bluePin,HIGH); 84 delay(1000); 85 digitalWrite(greenPin,HIGH); 86 delay(500); 87 digitalWrite(redPin,HIGH); 88 delay(500); 89 digitalWrite(redPin,LOW); 90 digitalWrite(bluePin,LOW); 91 digitalWrite(greenPin,LOW); 92 delay(800); 93 color(128,0,255); 94 delay(800); 95 color(255,0,0); 96 delay(800); 97 color(255,255,0); 98 delay(800); 99 color(255,255,255); 100 delay(800); 101 digitalWrite(bluePin,HIGH); 102 delay(1000); 103 digitalWrite(greenPin,HIGH); 104 delay(500); 105 digitalWrite(redPin,HIGH); 106 delay(1500); 107 digitalWrite(redPin,LOW); 108 digitalWrite(bluePin,LOW); 109 digitalWrite(greenPin,LOW); 110 delay(1000); 111 color(128,0,255); 112 delay(1000); 113 color(255,0,0); 114 delay(1500); 115 color(255,255,0); 116 delay(1000); 117 color(255,255,255); 118 delay(800); 119 digitalWrite(redPin,LOW); 120 digitalWrite(bluePin,LOW); 121 digitalWrite(greenPin,LOW); 122 break; 123 } 124 } 125 int buttonState = digitalRead(pushButton); 126 if (buttonState == 1) 127 { 128 lcd.clear(); 129 lcd.setCursor(0, 0); 130 lcd.print("Soil dry , water "); 131 lcd.setCursor(0,1); 132 lcd.print("system activated"); 133 digitalWrite(5, LOW); 134 135 } 136 else if (buttonState == 0) 137 { 138 lcd.clear(); 139 digitalWrite(5, HIGH); 140 } 141 142 143 144if (analogRead(A3) > 726) 145{ 146 lcd.clear(); 147 lcd.setCursor(0, 0); 148 digitalWrite(4,HIGH); 149 lcd.print("THEFT ALARM");// 150 delay(500); 151 digitalWrite(4,LOW); 152 delay(200); 153 digitalWrite(4,HIGH); 154 delay(200); 155 digitalWrite(4,LOW); 156 delay(200); 157 digitalWrite(4,HIGH); 158 delay(200); 159 digitalWrite(4,LOW); 160 delay(200); 161 digitalWrite(4,HIGH); 162 delay(500); 163 digitalWrite(4,LOW); 164 delay(200); 165 digitalWrite(4,HIGH); 166 delay(200); 167 digitalWrite(4,LOW); 168 delay(200); 169 digitalWrite(4,HIGH); 170 delay(200); 171 digitalWrite(4,LOW); 172 173 lcd.clear(); 174 175 176} 177 178 179 // Look for new cards 180 if ( ! mfrc522.PICC_IsNewCardPresent()) 181 { 182 return; 183 } 184 // Select one of the cards 185 if ( ! mfrc522.PICC_ReadCardSerial()) 186 { 187 return; 188 } 189 //Show UID on serial monitor 190 Serial.print("UID tag :"); 191 String content= ""; 192 byte letter; 193 for (byte i = 0; i < mfrc522.uid.size; i++) 194 { 195 Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "); 196 Serial.print(mfrc522.uid.uidByte[i], HEX); 197 content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ")); 198 content.concat(String(mfrc522.uid.uidByte[i], HEX)); 199 } 200 Serial.println(); 201 Serial.print("Message : "); 202 content.toUpperCase(); 203 if (content.substring(1) == "84 C9 90 79") //change here the UID of the card/cards that you want to give access 204 { 205 Serial.println("Authorized access"); 206 lcd.clear(); 207 lcd.setCursor(0, 0); // set the cursor to column 0, line 0 208 lcd.print("Welcome to the"); 209 lcd.setCursor(0, 1); // set the cursor to column 0, line 0 210 lcd.print("Smart Society"); 211 212 Serial.println(); 213 214 myServo.write(180); 215 delay(3000); 216 myServo.write(50); 217 218 lcd.clear(); 219 //digitalWrite(LED_G, LOW); 220 park = true; 221 } 222 223 else { 224 Serial.println(" Access denied"); 225 digitalWrite(4,HIGH); 226 lcd.clear(); 227 lcd.setCursor(0, 0); // set the cursor to column 0, line 0 228 lcd.print("Access denied");// 229 delay(1500); 230 digitalWrite(4,LOW); 231 delay(1500); 232 lcd.clear(); 233 234 } 235 if (analogRead(A0) > 900) 236 { 237 x = 0 ; 238 } 239 else { 240 x = 1; 241} 242if (analogRead(A1) > 900) 243 { 244 y = 0 ; 245 } 246 else { 247 y = 1; 248} 249if (analogRead(A2) > 900) 250 { 251 z = 0 ; 252 } 253 else { 254 z = 1; 255} 256 257 258 259 if (x == 0 && y == 0 && z == 0 ) 260 { 261 lcd.clear(); 262 lcd.setCursor(0, 0); // set the cursor to column 0, line 0 263 lcd.print("Slots free : "); 264 delay(1500); 265 lcd.setCursor(0,1); // set the cursor to column 0, line 0 266 lcd.print("A1"); 267 268 lcd.setCursor(5,1); // set the cursor to column 0, line 0 269 lcd.print("A2"); 270 271 lcd.setCursor(10,1 ); // set the cursor to column 0, line 0 272 lcd.print("A3"); 273 delay(4500); 274 lcd.clear(); 275 276 } 277 278 else if (x == 0 && y == 1 && z == 1) 279 { 280 lcd.clear(); 281 lcd.setCursor(0, 0); // set the cursor to column 0, line 0 282 lcd.print("Slots free : "); 283 delay(1800); 284 lcd.setCursor(0,1); // set the cursor to column 0, line 0 285 lcd.print("A1"); 286 287// lcd.setCursor(5,1); // set the cursor to column 0, line 0 288// lcd.print("A2"); 289// 290// lcd.setCursor(10,1 ); // set the cursor to column 0, line 0 291// lcd.print("A3"); 292 delay(3800); 293 lcd.clear(); 294 295 } 296 else if (x == 0 && y == 1 && z == 0 ) 297 { 298 lcd.clear(); 299 lcd.setCursor(0, 0); // set the cursor to column 0, line 0 300 lcd.print("Slots free : "); 301 delay(1800); 302 lcd.setCursor(0,1); // set the cursor to column 0, line 0 303 lcd.print("A1"); 304 305 // lcd.setCursor(5,1); // set the cursor to column 0, line 0 306 // lcd.print("A2"); 307 308 lcd.setCursor(10,1 ); // set the cursor to column 0, line 0 309 lcd.print("A3"); 310 delay(3800); 311 lcd.clear(); 312 313 } 314 else if (x == 1 && y == 1 && z == 0 ) 315 { 316 lcd.clear(); 317 lcd.setCursor(0, 0); // set the cursor to column 0, line 0 318 lcd.print("Slots free : "); 319 delay(1800); 320// lcd.setCursor(0,1); // set the cursor to column 0, line 0 321// lcd.print("A1"); 322// 323// lcd.setCursor(5,1); // set the cursor to column 0, line 0 324// lcd.print("A2"); 325 326 lcd.setCursor(10,1 ); // set the cursor to column 0, line 0 327 lcd.print("A3"); 328 delay(3800); 329 lcd.clear(); 330 331 } 332 else if (x == 0 && y == 0 && z == 1 ) 333 { 334 lcd.clear(); 335 lcd.setCursor(0, 0); // set the cursor to column 0, line 0 336 lcd.print("Slots free : "); 337 delay(1800); 338 lcd.setCursor(0,1); // set the cursor to column 0, line 0 339 lcd.print("A1"); 340 341 lcd.setCursor(5,1); // set the cursor to column 0, line 0 342 lcd.print("A2"); 343 344// lcd.setCursor(10,1 ); // set the cursor to column 0, line 0 345// lcd.print("A3"); 346 delay(3800); 347 lcd.clear(); 348 349 } 350 else if (x == 1 && y == 1 && z == 1 ) 351 { 352 lcd.clear(); 353 lcd.setCursor(0, 0); // set the cursor to column 0, line 0 354 lcd.print("Slots free : "); 355 delay(1800); 356 lcd.setCursor(0,1); // set the cursor to column 0, line 0 357 lcd.print("none"); 358 359// lcd.setCursor(5,1); // set the cursor to column 0, line 0 360// lcd.print("A2"); 361// 362// lcd.setCursor(10,1 ); // set the cursor to column 0, line 0 363// lcd.print("A3"); 364 delay(3800); 365 lcd.clear(); 366 367 } 368 else if (x == 1 && y == 0 && z == 0 ) 369 { 370 lcd.clear(); 371 lcd.setCursor(0, 0); // set the cursor to column 0, line 0 372 lcd.print("Slots free : "); 373 delay(1800); 374// lcd.setCursor(0,1); // set the cursor to column 0, line 0 375// lcd.print("A1"); 376 377 lcd.setCursor(5,1); // set the cursor to column 0, line 0 378 lcd.print("A2"); 379 380 lcd.setCursor(10,1 ); // set the cursor to column 0, line 0 381 lcd.print("A3"); 382 delay(3800); 383 lcd.clear(); 384 385 } 386 else if (x == 1 && y == 0 && z == 1 ) 387 { 388 lcd.clear(); 389 lcd.setCursor(0, 0); // set the cursor to column 0, line 0 390 lcd.print("Slots free : "); 391 delay(1800); 392// lcd.setCursor(0,1); // set the cursor to column 0, line 0 393// lcd.print("A1"); 394 395 lcd.setCursor(5,1); // set the cursor to column 0, line 0 396 lcd.print("A2"); 397 398 //lcd.setCursor(10,1 ); // set the cursor to column 0, line 0 399 // lcd.print("A3"); 400 delay(3800); 401 lcd.clear(); 402 403 } 404} 405 void color (unsigned char red, unsigned char green, unsigned char blue)// the color generating function 406{ 407 analogWrite(redPin, 255-red); // PWM signal output 408 analogWrite(greenPin, 255-green); // PWM signal output 409 analogWrite(bluePin, 255-blue); // PWM signal output 410} 411 412 413 414
Code of the project
c_cpp
*remove the rx pin of HC 05 before uploading the code
1#include <SPI.h> 2#include <MFRC522.h> 3#include <Servo.h> 4#include 5 <Wire.h> 6#include <LiquidCrystal_I2C.h> 7 8 LiquidCrystal_I2C lcd(0x27, 9 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); 10 11#define SS_PIN 10 12#define RST_PIN 13 9 14#define LED_G 5 //define green LED pin 15#define LED_R 4 //define red LED 16#define 17 BUZZER 2 //buzzer pin 18MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. 19int 20 x; 21int y; 22int z; 23int pushButton = 2; 24boolean park = false; 25int redPin 26 = 7; // R petal on RGB LED module connected to digital pin 11 27int greenPin 28 = 8; // G petal on RGB LED module connected to digital pin 9 29int bluePin = 6; 30Servo 31 myServo; //define servo name 32 33void setup() 34{ 35 Serial.begin(9600); 36 37 lcd.begin(16, 2); // Initiate a serial communication 38 SPI.begin(); // 39 Initiate SPI bus 40 mfrc522.PCD_Init(); // Initiate MFRC522 41 myServo.attach(3); 42 //servo pin 43 myServo.write(50); //servo start position 44 pinMode(LED_G, OUTPUT); 45 46 pinMode(LED_R, OUTPUT); 47 pinMode(BUZZER, OUTPUT); 48 pinMode(redPin, OUTPUT); 49 // sets the redPin to be an output 50 pinMode(greenPin, OUTPUT); // sets 51 the greenPin to be an output 52 pinMode(bluePin, OUTPUT); 53// pinMode(5, 54 OUTPUT); 55 56 // make the pushbutton's pin an input: 57 pinMode(pushButton, 58 INPUT); 59 pinMode(4, OUTPUT); 60 noTone(BUZZER); 61 pinMode(A0,INPUT); 62 63 pinMode(A1,INPUT); 64 Serial.println("Put your card to the reader..."); 65 66 Serial.println(); 67 68} 69void loop() 70{ 71 if (Serial.available() > 72 0) 73 { 74 int data = Serial.read(); 75 76 Serial.println(data); 77 78 79 switch (data) 80 81 { 82 case 66: 83 Serial.println("data2"); 84 85 digitalWrite(redPin,HIGH); 86 break; 87 88 case 65: 89 90 Serial.println("data1"); 91 digitalWrite(redPin,LOW); 92 digitalWrite(bluePin,LOW); 93 94 digitalWrite(greenPin,LOW); 95 break; 96 97 case 98 67: 99 digitalWrite(bluePin,HIGH); 100 break; 101 102 case 103 68: 104 digitalWrite(greenPin,HIGH); 105 break; 106 107 case 108 69: 109 digitalWrite(bluePin,HIGH); 110 delay(1000); 111 digitalWrite(greenPin,HIGH); 112 113 delay(500); 114 digitalWrite(redPin,HIGH); 115 delay(500); 116 117 digitalWrite(redPin,LOW); 118 digitalWrite(bluePin,LOW); 119 digitalWrite(greenPin,LOW); 120 121 delay(800); 122 color(128,0,255); 123 delay(800); 124 color(255,0,0); 125 126 delay(800); 127 color(255,255,0); 128 delay(800); 129 130 color(255,255,255); 131 delay(800); 132 digitalWrite(bluePin,HIGH); 133 134 delay(1000); 135 digitalWrite(greenPin,HIGH); 136 delay(500); 137 138 digitalWrite(redPin,HIGH); 139 delay(1500); 140 digitalWrite(redPin,LOW); 141 142 digitalWrite(bluePin,LOW); 143 digitalWrite(greenPin,LOW); 144 delay(1000); 145 146 color(128,0,255); 147 delay(1000); 148 color(255,0,0); 149 150 delay(1500); 151 color(255,255,0); 152 delay(1000); 153 154 color(255,255,255); 155 delay(800); 156 digitalWrite(redPin,LOW); 157 158 digitalWrite(bluePin,LOW); 159 digitalWrite(greenPin,LOW); 160 break; 161 162 } 163 } 164 int buttonState = digitalRead(pushButton); 165 if (buttonState 166 == 1) 167 { 168 lcd.clear(); 169 lcd.setCursor(0, 0); 170 lcd.print("Soil 171 dry , water "); 172 lcd.setCursor(0,1); 173 lcd.print("system activated"); 174 175 digitalWrite(5, LOW); 176 177 } 178 else if (buttonState == 0) 179 { 180 lcd.clear(); 181 182 digitalWrite(5, HIGH); 183 } 184 185 186 187if (analogRead(A3) > 726) 188{ 189 190 lcd.clear(); 191 lcd.setCursor(0, 0); 192 digitalWrite(4,HIGH); 193 lcd.print("THEFT 194 ALARM");// 195 delay(500); 196 digitalWrite(4,LOW); 197 delay(200); 198 199 digitalWrite(4,HIGH); 200 delay(200); 201 digitalWrite(4,LOW); 202 203 delay(200); 204 digitalWrite(4,HIGH); 205 delay(200); 206 digitalWrite(4,LOW); 207 208 delay(200); 209 digitalWrite(4,HIGH); 210 delay(500); 211 digitalWrite(4,LOW); 212 213 delay(200); 214 digitalWrite(4,HIGH); 215 delay(200); 216 digitalWrite(4,LOW); 217 218 delay(200); 219 digitalWrite(4,HIGH); 220 delay(200); 221 digitalWrite(4,LOW); 222 223 224 lcd.clear(); 225 226 227} 228 229 230 // Look for new 231 cards 232 if ( ! mfrc522.PICC_IsNewCardPresent()) 233 { 234 return; 235 } 236 237 // Select one of the cards 238 if ( ! mfrc522.PICC_ReadCardSerial()) 239 { 240 241 return; 242 } 243 //Show UID on serial monitor 244 Serial.print("UID tag 245 :"); 246 String content= ""; 247 byte letter; 248 for (byte i = 0; i < mfrc522.uid.size; 249 i++) 250 { 251 Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "); 252 253 Serial.print(mfrc522.uid.uidByte[i], HEX); 254 content.concat(String(mfrc522.uid.uidByte[i] 255 < 0x10 ? " 0" : " ")); 256 content.concat(String(mfrc522.uid.uidByte[i], 257 HEX)); 258 } 259 Serial.println(); 260 Serial.print("Message : "); 261 content.toUpperCase(); 262 263 if (content.substring(1) == "84 C9 90 79") //change here the UID of the card/cards 264 that you want to give access 265 { 266 Serial.println("Authorized access"); 267 268 lcd.clear(); 269 lcd.setCursor(0, 0); // set the cursor to column 270 0, line 0 271 lcd.print("Welcome to the"); 272 lcd.setCursor(0, 1); // 273 set the cursor to column 0, line 0 274 lcd.print("Smart Society"); 275 276 277 Serial.println(); 278 279 myServo.write(180); 280 delay(3000); 281 282 myServo.write(50); 283 284 lcd.clear(); 285 //digitalWrite(LED_G, 286 LOW); 287 park = true; 288 } 289 290 else { 291 Serial.println(" Access 292 denied"); 293 digitalWrite(4,HIGH); 294 lcd.clear(); 295 lcd.setCursor(0, 296 0); // set the cursor to column 0, line 0 297 lcd.print("Access denied");// 298 299 delay(1500); 300 digitalWrite(4,LOW); 301 delay(1500); 302 lcd.clear(); 303 304 305 } 306 if (analogRead(A0) > 900) 307 { 308 x = 0 ; 309 } 310 311 else { 312 x = 1; 313} 314if (analogRead(A1) > 900) 315 { 316 y = 0 ; 317 318 } 319 else { 320 y = 1; 321} 322if (analogRead(A2) > 900) 323 { 324 z 325 = 0 ; 326 } 327 else { 328 z = 1; 329} 330 331 332 333 if (x == 0 && y 334 == 0 && z == 0 ) 335 { 336 lcd.clear(); 337 lcd.setCursor(0, 0); // 338 set the cursor to column 0, line 0 339 lcd.print("Slots free : "); 340 delay(1500); 341 342 lcd.setCursor(0,1); // set the cursor to column 0, line 0 343 lcd.print("A1"); 344 345 346 lcd.setCursor(5,1); // set the cursor to column 0, line 347 0 348 lcd.print("A2"); 349 350 lcd.setCursor(10,1 ); // set 351 the cursor to column 0, line 0 352 lcd.print("A3"); 353 delay(4500); 354 355 lcd.clear(); 356 357 } 358 359 else if (x == 0 && y == 1 && z == 1) 360 361 { 362 lcd.clear(); 363 lcd.setCursor(0, 0); // set the cursor 364 to column 0, line 0 365 lcd.print("Slots free : "); 366 delay(1800); 367 368 lcd.setCursor(0,1); // set the cursor to column 0, line 0 369 lcd.print("A1"); 370 371 372// lcd.setCursor(5,1); // set the cursor to column 0, line 373 0 374// lcd.print("A2"); 375// 376// lcd.setCursor(10,1 ); // 377 set the cursor to column 0, line 0 378// lcd.print("A3"); 379 delay(3800); 380 381 lcd.clear(); 382 383 } 384 else if (x == 0 && y == 1 && z == 0 ) 385 { 386 387 lcd.clear(); 388 lcd.setCursor(0, 0); // set the cursor to 389 column 0, line 0 390 lcd.print("Slots free : "); 391 delay(1800); 392 393 lcd.setCursor(0,1); // set the cursor to column 0, line 0 394 lcd.print("A1"); 395 396 397 // lcd.setCursor(5,1); // set the cursor to column 0, line 398 0 399 // lcd.print("A2"); 400 401 lcd.setCursor(10,1 ); // 402 set the cursor to column 0, line 0 403 lcd.print("A3"); 404 delay(3800); 405 406 lcd.clear(); 407 408 } 409 else if (x == 1 && y == 1 && z == 0 ) 410 { 411 412 lcd.clear(); 413 lcd.setCursor(0, 0); // set the cursor to 414 column 0, line 0 415 lcd.print("Slots free : "); 416 delay(1800); 417// 418 lcd.setCursor(0,1); // set the cursor to column 0, line 0 419// lcd.print("A1"); 420// 421 422// lcd.setCursor(5,1); // set the cursor to column 0, line 423 0 424// lcd.print("A2"); 425 426 lcd.setCursor(10,1 ); // 427 set the cursor to column 0, line 0 428 lcd.print("A3"); 429 delay(3800); 430 431 lcd.clear(); 432 433 } 434 else if (x == 0 && y == 0 && z == 1 ) 435 { 436 437 lcd.clear(); 438 lcd.setCursor(0, 0); // set the cursor to 439 column 0, line 0 440 lcd.print("Slots free : "); 441 delay(1800); 442 443 lcd.setCursor(0,1); // set the cursor to column 0, line 0 444 lcd.print("A1"); 445 446 447 lcd.setCursor(5,1); // set the cursor to column 0, line 448 0 449 lcd.print("A2"); 450 451// lcd.setCursor(10,1 ); // 452 set the cursor to column 0, line 0 453// lcd.print("A3"); 454 delay(3800); 455 456 lcd.clear(); 457 458 } 459 else if (x == 1 && y == 1 && z == 1 ) 460 { 461 462 lcd.clear(); 463 lcd.setCursor(0, 0); // set the cursor to 464 column 0, line 0 465 lcd.print("Slots free : "); 466 delay(1800); 467 468 lcd.setCursor(0,1); // set the cursor to column 0, line 0 469 lcd.print("none"); 470 471 472// lcd.setCursor(5,1); // set the cursor to column 0, line 473 0 474// lcd.print("A2"); 475// 476// lcd.setCursor(10,1 ); // 477 set the cursor to column 0, line 0 478// lcd.print("A3"); 479 delay(3800); 480 481 lcd.clear(); 482 483 } 484 else if (x == 1 && y == 0 && z == 0 ) 485 { 486 487 lcd.clear(); 488 lcd.setCursor(0, 0); // set the cursor to 489 column 0, line 0 490 lcd.print("Slots free : "); 491 delay(1800); 492// 493 lcd.setCursor(0,1); // set the cursor to column 0, line 0 494// lcd.print("A1"); 495 496 497 lcd.setCursor(5,1); // set the cursor to column 0, line 498 0 499 lcd.print("A2"); 500 501 lcd.setCursor(10,1 ); // set 502 the cursor to column 0, line 0 503 lcd.print("A3"); 504 delay(3800); 505 506 lcd.clear(); 507 508 } 509 else if (x == 1 && y == 0 && z == 1 ) 510 { 511 512 lcd.clear(); 513 lcd.setCursor(0, 0); // set the cursor to 514 column 0, line 0 515 lcd.print("Slots free : "); 516 delay(1800); 517// 518 lcd.setCursor(0,1); // set the cursor to column 0, line 0 519// lcd.print("A1"); 520 521 522 lcd.setCursor(5,1); // set the cursor to column 0, line 523 0 524 lcd.print("A2"); 525 526 //lcd.setCursor(10,1 ); // 527 set the cursor to column 0, line 0 528 // lcd.print("A3"); 529 delay(3800); 530 531 lcd.clear(); 532 533 } 534} 535 void color (unsigned char red, unsigned 536 char green, unsigned char blue)// the color generating function 537{ 538 analogWrite(redPin, 539 255-red); // PWM signal output 540 analogWrite(greenPin, 255-green); 541 // PWM signal output 542 analogWrite(bluePin, 255-blue); // PWM signal output 543} 544 545 546 547 548
Documentation
This is how we will assemble the project
Schematics rfid pins - rst to D9 sda to D10 mosi to D11 miso to D12 sck to D13 LDR signal pin to A3 infrared signal pins to a0 a1 and a2 respectively in RGB led,r to7 ,green to 8 ,blue to 6 Buzzer pin to D4 servomotor signal pin to D3 HC 05 Bluetooth module signal pin to D0
This is how we will assemble the project
Comments
Only logged in users can leave comments