In this project, as the mobile application contains three buttons, with one button for each floor, this does not automatically notify the elevator system which floor the user is currently at, which requires the user to press the floor button to request an elevator car and wait for the elevator car to arrive to the respective floor, and then press the button again after the elevator car arrived and the user goes into the elevator car to go to the destination floor, which can be bothersome as there is a delay between the two buttons pressed. Hence, an additional feature can be added to the mobile application, such as pressing the two different floor buttons in a row for requesting the elevator car to move to the respective floor and then automatically move to the destination floor. By implementing this feature, it will reduce the time for the users to hold use their mobile phones to use the mobile application to reach the destination floor.
Additionally, there is an accuracy error from the admin RFID reader, which might to due to the RFID card being removed too quickly away from the reader, causing the reader to not be able to fully rewrite the UID of the card, and causing the card to be unreadable. Hence, it can be improved further by only turning on the admin RFID reader and rewriting the RFID card instantly after pressing a button, instead of having the admin RFID reader in an operating state constantly, then scanning the RFID card after pressing the buttons to change the UID of the card.
This recommendation can avoid having the reader partially rewrite the UID of the card, and able to minimize the issue of damaging the RFID cards.
Lastly, as mentioned earlier, the RFID system is not working as expected after implemented onto the PCB. Hence, the recommendation to improve the RFID system to be able to function after implemented onto the PCB are to add a buffer for each RFID reader to prevent the signal for the SPI from being affected by any other load attributes.
REFERENCES
Amit, 2020. Huawei launched a Contactless Smart Elevator Solution. [online]
Available at: <https://www.huaweiupdate.com/huawei-launched-a-contactless- smart-elevator-solution/> [Accessed 30 March 2022].
Amsler, S., 2021. RFID (radio frequency identification). [online] Available at:
<https://www.techtarget.com/iotagenda/definition/RFID-radio-frequency- identification> [Accessed 29 March 2022].
Arduino, 2018. Analog Input. [online] Available at:
<https://www.arduino.cc/en/Tutorial/BuiltInExamples/AnalogInput> [Accessed 21 August 2022].
Arduino, 2018. What is Arduino? [online] Available at:
<https://www.arduino.cc/en/Guide/Introduction> [Accessed 24 March 2022].
Arduino, 2022. Arduino WiFi Shield. [online] Available at:
<https://docs.arduino.cc/retired/shields/arduino-wifi-shield> [Accessed 24 March 2022].
Arduino, 2022. ATmega2560-Arduino Pin Mapping. [online] Available at:
<https://docs.arduino.cc/hacking/hardware/PinMapping2560> [Accessed 12 July 2022].
Arduino, n.d.. Arduino Mega 2560 Rev3. [online] Available at:
<https://docs.arduino.cc/hardware/mega-2560> [Accessed 3 April 2022].
Arduino, n.d.. Arduino Uno R3. [online] Available at:
<https://docs.arduino.cc/hardware/uno-rev3> [Accessed 3 April 2022].
Arellano, J., 2019. Bluetooth vs. Wi-Fi for IoT: Which is Better? [online] Available at: <https://www.verypossible.com/insights/bluetooth-vs.-wi-fi-for-iot-which-is- better> [Accessed 3 April 2022].
Bellis, M., 2019. The History of Elevators From Top to Bottom. [online] Available at:
<https://www.thoughtco.com/history-of-the-elevator-1991600> [Accessed 16 March 2022].
Blattenberger, K., 2020. Understanding Electromagnetic Wave Physics. [image
online] Available at:
<https://www.rfcafe.com/references/electrical/electromagnetic-wave- physics.htm> [Accessed 25 March 2022].
Carson Elevator, 2016. How Do Elevators Work? [online] Available at:
<https://www.carsonelevator.com/2016/01/how-do-elevators-work/> [Accessed 16 March 2022].
Claassen, R., 2021. Smart Elevators: Giving IoT a Lift. [online] Available at:
<https://www.smart-industry.net/smart-elevators-giving-iot-a-lift/> [Accessed 30 March 2022].
Cunningham, D., 2020. Blynk vs. MIT’s App Inventor… the sky’s the limit! [online]
Available at: <http://nosleep.ca/blynk-vs-mits-app-inventor-the-skys-the-limit/>
[Accessed 2 April 2022].
Cytron, 2016. Cytron ESP8266 WiFi Shield. [online] Available at:
<https://my.cytron.io/p-cytron-esp8266-wifi-shield> [Accessed 3 April 2022].
Cytron, n.d.. ESP-WROOM-02 Wi-Fi Module. [online] Available at:
<https://my.cytron.io/p-esp-wroom-02-wi-fi-module> [Accessed 3 April 2022].
Darnley, A., 2015. A Brief History of Elevators. [online] Available at:
<https://www.elevators.com/a-brief-history-of-elevators/> [Accessed 16 March 2022].
Dbouk, T. and Drikakis, D., 2021. On airborne virus transmission in elevators and confined spaces. Physics of Fluids, [e-journal] 33(1), 011905. Available at:
<https://doi.org/10.1063/5.0038180> [Accessed 23 March 2022].
EG Projects, n.d.. Controlling Servo Motor with Stm32f103 microcontroller using stm32cubemx code configurator by STMicroelectronics and keil uvision 5 ide for cortex m1 series microcontrollers. [image online] Available at:
<https://www.engineersgarage.com/interfacing-servo-motor-with-stm32/>
[Accessed 4 April 2022].
Electronics Tutorials, 2013. Pulse Width Modulation. Electronics-Tutorials.ws blog, [blog] 10 September. Available at: <https://www.electronics- tutorials.ws/blog/pulse-width-modulation.html> [Accessed 4 April 2022].
Elktros, 2016. Arduino Introduction. [online] Available at:
<https://www.electronicshub.org/arduino-introduction/> [Accessed 24 March 2022].
Elprocus, 2015. What is an IR Sensor: Circuit Diagram & Its Working. [online]
Available at: <https://www.elprocus.com/infrared-ir-sensor-circuit-and-working/>
[Accessed 4 April 2022].
Elprocus, 2019. What is Elevator: Working, Different Types, and Their Uses. [online]
Available at: <https://www.elprocus.com/what-is-elevator-working-different- types-and-their-uses/> [Accessed 16 March 2022].
Forino, C., 2016. Detecting obstacle with IR Sensor and Arduino.
PLAYEmbedded.org blog, [blog] 8 January. Available at:
<https://www.playembedded.org/blog/detecting-obstacle-with-ir-sensor-and- arduino/> [Accessed 4 April 2022].
Fry, M., 2020. Preventing corona, Huawei introduces the solution to control elevators without pressing buttons. [online] Available at:
<https://tipsmake.com/preventing-corona-huawei-introduces-the-solution-to- control-elevators-without-pressing-buttons> [Accessed 30 March 2022].
Harada, n.d.. What are Radio Waves? [online] Available at:
<https://www.harada.com/en/innovation/about/radio.html> [Accessed 26 March 2022].
Hussey, C., 2019. 8 Elevator Upgrades That Deliver the Most Value. [online]
Available at: <https://www.facilitiesnet.com/elevators/contributed/8-Elevator- Upgrades-That-Deliver-the-Most-Value--43334> [Accessed 18 March 2022].
Hyundai Elevator, n.d.. Clean Moving Solutions. [online] Available at:
<https://www.hyundaielevator.com/en/technology/smart> [Accessed 31 March].
Ikimi, E., 2020. Antenna Basics: Working Principle, Types, and Applications. [online]
Available at: <https://www.electronicspoint.com/research/antenna-basics- working-principle-types-and-applications/> [Accessed 28 March 2022].
Jardine Schindler, 2021. Schindler in Hong Kong launches “kNOw Touch Contactless Elevator Control Panel”. [online] Available at:
<https://www.jardineschindler.com/en/media/news-press-releases/schindler-in- hong-kong-launches-know-touch-contactless-elevator-control-panel.html>
[Accessed 31 March 2022].
Jimenez, L. R., 2018. How an Elevator Access Control System Can Benefit Your Building. Linkedin, [online] Available at: <https://www.linkedin.com/pulse/how- elevator-access-control-system-can-benefit-your-building-
jimenez?trk=public_profile_article_view> [Accessed 19 March 2022].
Kashyap, S., 2022. What is Gantt chart? – Definition, Benefits & Tools. ProofHub, [online] Available at: <https://www.proofhub.com/articles/gantt-charts>
[Accessed 5 April 2022].
Lee, Z. J., 2020. Duo Elevator Control System. Kampar: Universiti Tunku Abdul Rahman.
Londa, S., 2021. Smart Elevator Technology ft. Touchless Experience. [online]
Available at: <https://c.realme.com/in/post-details/1397977899348369408>
[Accessed 1 April 2022].
Loo, S., 2020. Tech for Good | Huawei Cloud IoT and Wanglong launch
“contactless elevator ride”. [online] Available at:
<https://technode.com/2020/02/14/tech-for-good-huawei-cloud-iot-and- wanglong-launch-contactless-elevator-ride/> [Accessed 30 March 2022].
Lucas, J., 2019. What Are Radio Waves? [online] Available at:
<https://www.livescience.com/50399-radio-waves.html> [Accessed 25 March 2022].
MAD Elevator, n.d.. Touchless Elevator Buttons. [online] Available at:
<https://www.madelevator.com/touchless-elevator-buttons/page.html> [Accessed 31 March 2022].
Mahajan, K., Nahar, R., Khairnar, D., Kinge, S. and Suryawanshi, S., 2021. Elevator Control Usibg Speech Recognition for People with Physical Disabilities. [online]
Available at:
<https://ijariie.com/AdminUploadPdf/Elevator_Control_Using_Speech_Recogniti on_for_People_with_Physical_Disabilities_ijariie14153.pdf> [Accessed 1 April 2022].
Mitchell, E., 2016. What is the FirebaseDB? AppInventorplus.wordpress.com, [blog]
1 August. Available at: <https://appinventorplus.wordpress.com/2016/08/01/what- is-the-firebasedb/> [Accessed 18 April 2022].
Parker-Pope, T., 2020. Can I Get Coronavirus From Riding an Elevator? [online]
Available at: <https://www.nytimes.com/2020/05/13/well/live/can-i-get- coronavirus-from-riding-an-elevator.html> [Accessed 23 March 2022].
Patel, V., 2020. Huawei introduces Smartphone controlled Elevator Solution to Minimize the Risk of Virus Infection. [online] Available at:
<https://www.gizmochina.com/2020/02/13/huawei-introduces-phone-controlled- elevator-solution-to-minimize-the-risk-of-virus-infection/> [Accessed 30 March 2022].
Raza, M., 2019. System Reliability & Availability Calculations. BMC.com blog, [blog] 9 October. Available at: <https://www.bmc.com/blogs/system-reliability- availability-calculations/> [Accessed 22 August 2022].
Sandhu, R., 2021. An Overview of Arduino and Its Importance. [online] Available at:
<https://www.lifewire.com/what-is-arduino-2495652> [Accessed 24 March].
Silva Consultants, n.d.. Weaknesses of Elevator Access Control. [online] Available at:
<https://www.silvaconsultants.com/new-security-tips-1/weaknesses-of-elevator- access-control> [Accessed 19 March 2022].
Techno Pedia, 2018. Factors Affecting the Behavior of Radio Waves. [online]
Available at: <https://www.technopediasite.com/2018/06/factors-affecting- behavior-of-radio.html> [Accessed 26 March 2022].
The Coding Bus, 2020. How to create login and signup in MIT App Inventor using
Firebase. [video online] Available at:
<https://www.youtube.com/watch?v=_boq4iZKucs> [Accessed 2 April 2022].
Thompson, J., 2021. Reasons to Use an Elevator Card Access System. [online]
Available at: <https://cardlockcompany.com/reasons-to-use-an-elevator-card- access-system/> [Accessed 19 March 2022].
Toyama, n.d.. ELSafe Contactless Elevators. [online] Available at:
<https://www.toyamaworld.com/elsafe-contactless-elevators> [Accessed 30 March 2022].
Tutorials Point, n.d.. Arduino – Overview. [online] Available at:
<https://www.tutorialspoint.com/arduino/arduino_overview.htm> [Accessed 24 March].
United Nations ESCAP, 2018. Building Disability-Inclusive Societies in Asia and the
Pacific [online] Available at:
<https://www.unescap.org/sites/default/files/publications/SDD%20BDIS%20repo rt%20A4%20v14-5-E.pdf> [Accessed 29 August 2022] .
Woodford, C., 2021. Antennas and transmitters. [online] Available at:
<https://www.explainthatstuff.com/antennas.html> [Accessed 28 March 2022].
World Health Organization, 2020. Modes of transmission of virus causing COVID- 19: implications for IPC precaution recommendations. [online] Available at:
<https://www.who.int/news-room/commentaries/detail/modes-of-transmission-of- virus-causing-covid-19-implications-for-ipc-precaution-recommendations>
[Accessed 23 March 2022].
APPENDICES
APPENDIX A: Coding for Elevator System
#include <Servo.h>
#include <CytronWiFiShield.h>
#include <CytronWiFiServer.h>
#include <SoftwareSerial.h>
#include <SPI.h>
#include <MFRC522.h>
#define WiFi
#define RST_PIN 53 // Configurable, see typical pin layout
#define SS_1_PIN 49 // Configurable, take a unused pin, only HIGH/LOW required, must be different from other SSs
#define SS_2_PIN 48 // Configurable, take a unused pin, only HIGH/LOW required, must be different from other SSs
#define SS_3_PIN 47 // Configurable, take a unused pin, only HIGH/LOW required, must be different from other SSs
#define SS_4_PIN 46 // Configurable, take a unused pin, only HIGH/LOW required, must be different from other SSs
#define NR_OF_READERS 4
#define First_UID {0x10, 0x2C, 0xBE, 0x1A}
#define Second_UID {0xF0, 0xC4, 0xF4, 0x19}
#define Third_UID {0xC3, 0xA3, 0xDB, 0x11}
//For Arduino WiFi Shield--- char ssid[] = "Dicky"; // your network SSID (name) char pass[] = "dicky1800350"; // your network password
int keyIndex = 0; // your network key Index number (needed only for WEP) ESP8266Server server(80);
bool status = false;
//For LED latching--- int clockpin = 5;
int latchpin = 6;
int datapin = 7;
//For LED that links with floor buttons--- int ledfst = 36;
int ledsnd = 38;
int ledtrd = 40;
//For Elevator Movement--- int elevatorup = 26;
int elevatordown = 28;
int door = 13;
//For setting the pin input and output--- int i;
int j;
int k;
int l;
//For Floor Indicator---
byte ssdfst = B00000110;
byte ssdsnd = B01011011;
byte ssdtrd = B01001111;
byte def = B00000000;
//For Floor Button--- int buttonfst = 8;
int buttonsnd = 9;
int buttontrd = 10;
//For Floor Sensor--- int magtrd = 30;
int magsnd = 32;
int magfst = 34;
//For Elevator Door--- Servo;
int angle = 90;
int doorsensor;
int doorstatus;
//For RFID---
byte ssPins[] = {SS_1_PIN, SS_2_PIN, SS_3_PIN, SS_4_PIN};
String content = "";
int rfidfst = 35;
int rfidsnd = 33;
int rfidtrd = 31;
int buzzer = 37;
int autofst;
int autosnd;
int autotrd;
MFRC522 mfrc522[NR_OF_READERS]; // Create MFRC522 instance.
MFRC522::MIFARE_Key key;
//--- void setup()
{
//Setting pin mode--- pinMode(13, OUTPUT);
for(i = 5; i <= 7; i++) {
pinMode(i, OUTPUT);
}
for(j = 24; j <= 29; j++) {
pinMode(j, OUTPUT);
}
for(k = 30; k <= 35; k++) {
pinMode(k, INPUT);
}
for(l = 36; l <= 42; l++) {
pinMode(l, OUTPUT);
}
//Setting all input as HIGH to avoid any unnecessary signals--- digitalWrite(magfst, HIGH);
digitalWrite(magsnd, HIGH);
digitalWrite(magtrd, HIGH);
digitalWrite(buttonfst, HIGH);
digitalWrite(buttonsnd, HIGH);
digitalWrite(buttontrd, HIGH);
digitalWrite(rfidfst, HIGH);
digitalWrite(rfidsnd, HIGH);
digitalWrite(rfidtrd, HIGH);
//Setting latching function on LEDs--- digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, ssdfst);
digitalWrite(latchpin, HIGH);
//Setting elevator door initially closed--- servo.attach(24); //servo signal pin
servo.write(angle);
servo.detach();
Serial.begin(9600); // initialize serial communication with the PC
// check for the presence of the shield:--- if (!WiFi.begin(10, 11))
{
Serial.println("WiFi shield not present");
while (true); // don't continue }
String fv = WiFi.firmwareVersion();
Serial.println(fv);
// attempt to connect to Wifi network:
while (!status) {
Serial.print("Attempting to connect to Network named: ");
Serial.println(ssid); // print the network name (SSID);
status = WiFi.connectAP(ssid, pass); // Connect to WPA/WPA2 network.
Change this line if using open or WEP network:
}
server.begin(); // start the web server on port 80
printWifiStatus(); // you're connected now, so print out the status //Setting RFID---
SPI.begin(); // Init SPI bus
for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) {
mfrc522[reader].PCD_Init(ssPins[reader], RST_PIN); // Init each MFRC522 card Serial.print(F("Reader "));
Serial.print(reader);
Serial.print(F(": "));
mfrc522[reader].PCD_DumpVersionToSerial();
}
// Prepare key - all keys are set to FFFFFFFFFFFFh at chip delivery from the factory.
for (byte i = 0; i < 6; i++) {
key.keyByte[i] = 0xFF;
} }
void loop() {
//Checking RFID to receive information--- for (uint8_t reader = 0; reader < NR_OF_READERS; reader++)
{
// Look for new cards
if (mfrc522[reader].PICC_IsNewCardPresent() &&
mfrc522[reader].PICC_ReadCardSerial()) {
Serial.print(F("Reader "));
Serial.print(reader);
// Show some details of the PICC (that is: the tag/card) Serial.print(F(": Card UID:"));
String content = "";
for (byte i = 0; i < mfrc522[reader].uid.size; i++) {
Serial.print(mfrc522[reader].uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(mfrc522[reader].uid.uidByte[i], HEX);
content.concat(String(mfrc522[reader].uid.uidByte[i] < 0x10 ? " 0" : " "));
content.concat(String(mfrc522[reader].uid.uidByte[i], HEX));
}
Serial.println();
content.toUpperCase();
//Checking which card and reader triggered--- if (reader == 1 && content.substring(1) == "F0 C4 F4 19")
{
digitalWrite(ledfst, HIGH);
autosnd = 1;
Serial.print ("From First Floor to Second Floor");
Serial.println();
}
if (reader == 1 && content.substring(1) == "C3 A3 DB 11") {
digitalWrite(ledfst, HIGH);
autotrd = 1;
Serial.print ("From First Floor to Third Floor");
Serial.println();
}
if (reader == 2 && content.substring(1) == "F0 C4 F4 19") {
digitalWrite(ledsnd, HIGH);
autofst = 1;
Serial.print ("From Second Floor to First Floor");
Serial.println();
}
if (reader == 2 && content.substring(1) == "C3 A3 DB 11") {
digitalWrite(ledsnd, HIGH);
autotrd = 1;
Serial.print ("From Second Floor to Third Floor");
Serial.println();
}
if (reader == 3 && content.substring(1) == "F0 C4 F4 19") {
digitalWrite(ledtrd, HIGH);
autosnd = 1;
Serial.print ("From Third Floor to Second Floor");
Serial.println();
}
if (reader == 3 && content.substring(1) == "C3 A3 DB 11") {
digitalWrite(ledtrd, HIGH);
autofst = 1;
Serial.print ("From Third Floor to First Floor");
Serial.println();
}
//Writing new UID to card--- if (reader == 0 && digitalRead(rfidfst) == 0)
{
byte newUid[] = First_UID;
if ( mfrc522[0].MIFARE_SetUid(newUid, (byte)4, true) ) {
Serial.println("Wrote new UID for First Floor to card.");
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
} }
if (reader == 0 && digitalRead(rfidsnd) == 0) {
byte newUid[] = Second_UID;
if ( mfrc522[0].MIFARE_SetUid(newUid, (byte)4, true) ) {
Serial.println("Wrote new UID for Second Floor to card.");
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
delay(100);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
} }
if (reader == 0 && digitalRead(rfidtrd) == 0) {
byte newUid[] = Third_UID;
if ( mfrc522[0].MIFARE_SetUid(newUid, (byte)4, true) ) {
Serial.println("Wrote new UID for Third Floor to card.");
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
delay(100);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
delay(100);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
} }
// Halt PICC
mfrc522[reader].PICC_HaltA();
// Stop encryption on PCD
mfrc522[reader].PCD_StopCrypto1();
} //if (mfrc522[reader].PICC_IsNewC } //for(uint8_t reader
//Linking buttons to LEDs--- if(digitalRead(buttonfst) == 0)
{
digitalWrite(ledfst, HIGH);
}
if(digitalRead(buttonsnd) == 0) {
digitalWrite(ledsnd, HIGH);
}
if(digitalRead(buttontrd) == 0) {
digitalWrite(ledtrd, HIGH);
}
//1st floor button pressed--- if((digitalRead(magfst) == 0) && (digitalRead(ledfst) == 1)) {
stop();
digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, ssdfst);
digitalWrite(latchpin, HIGH);
delay(1000);
digitalWrite(ledfst, LOW);
opendoor();
checkStatus();
}
if((digitalRead(magsnd) == 0) && (digitalRead(ledfst) == 1) &&
(digitalRead(ledtrd) == 0)) {
down();
digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, ssdsnd);
digitalWrite(latchpin, HIGH);
}
if((digitalRead(magtrd) == 0) && (digitalRead(ledfst) == 1)) {
down();
digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, ssdtrd);
digitalWrite(latchpin, HIGH);
}
//2nd floor button pressed--- if((digitalRead(magfst) == 0) && (digitalRead(ledsnd) == 1)) {
up();
digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, ssdfst);
digitalWrite(latchpin, HIGH);
}
if((digitalRead(magsnd) == 0) && (digitalRead(ledsnd) == 1)) {
stop();
digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, ssdsnd);
digitalWrite(latchpin, HIGH);
delay(1000);
digitalWrite(ledsnd, LOW);
opendoor();
checkStatus();
}
if((digitalRead(magtrd) == 0) && (digitalRead(ledsnd) == 1))
{
down();
digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, ssdtrd);
digitalWrite(latchpin, HIGH);
}
//1st and 3rd floor buttons pressed on 2nd floor--- if((digitalRead(magsnd) == 0) && (digitalRead(ledfst) == 1) &&
(digitalRead(ledtrd) == 1)) {
up();
digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, ssdsnd);
digitalWrite(latchpin, HIGH);
}
//3rd floor button pressed--- if((digitalRead(magfst) == 0) && (digitalRead(ledtrd) == 1)) {
up();
digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, ssdfst);
digitalWrite(latchpin, HIGH);
}
if((digitalRead(magsnd) == 0) && (digitalRead(ledfst) == 0) &&
(digitalRead(ledtrd) == 1)) {
up();
digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, ssdsnd);
digitalWrite(latchpin, HIGH);
}
if((digitalRead(magtrd) == 0) && (digitalRead(ledtrd) == 1)) {
stop();
digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, ssdtrd);
digitalWrite(latchpin, HIGH);
delay(1000);
digitalWrite(ledtrd, LOW);
opendoor();
checkStatus();
}
//Checking Mobile Application to receive information--- ESP8266Client client = server.available(); // listen for incoming clients if(!client) return;
Serial.println("new client");
if (client.connected()) //if client is present and connected {
String s = client.readStringUntil('\r'); //get the first line of request // Check to see if the client request was "GET /H" or "GET /L":
if (strstr(s.c_str(),"GET /F")) {
digitalWrite(ledfst, HIGH); // GET /F turns the first floor LED on }
else if (strstr(s.c_str(),"GET /S")) {
digitalWrite(ledsnd, HIGH); // GET /S turns the second floor LED off }
else if (strstr(s.c_str(),"GET /T"))
{
digitalWrite(ledtrd, HIGH); // GET /T turns the third floor LED off }
Serial.print(s);
while(client.available())
Serial.write(client.read()); // print the client request out the serial monitor
// HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK) // and a content-type so the client knows what's coming, then a blank line:
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println();
// the content of the HTTP response follows the header:
client.print("Click <a href=\"/F\">here</a> turn the First Floor LED on<br>");
client.print("Click <a href=\"/S\">here</a> turn the Second Floor LED on<br>");
client.print("Click <a href=\"/T\">here</a> turn the Third Floor LED on<br>");
// The HTTP response ends with another blank line:
client.println();
// close the connection:
client.stop();
Serial.println("client disconnected");
} }
void opendoor() {
servo.attach(24); //servo signal pin--- digitalWrite(door, HIGH);