FOr this week I needed to use Arduino IDE to build my circuit's code with written text .
for this week I wanted to design a smart corridor that has an automatic open door ( first part of the project ) and a sensitive light system ( the second part ).
This week I wanted to simulate a smart corridor system that opens and closes the door automatically then it turns the corridor's light on while you're moving around .
I used a PIR sensor to simulate the circuit using TINKERCAD instead of microwave sensor as its not valid in TINKERCAD and both of them have the same logic .
for the first part I needed to use an ultrasonic sensor as an INPUT that gives signal to a servo motor as an OUTPUT .
that's the part where the door opens when you are closer than 50 cm and waits for 5 seconds till you enter .
for the second part I needed to use a microwave sensor as an INPUT and an LED to simulate light system as an OUTPUT to simulate the second part of the project .
That's when the light turned on when the microwave sensor detect the door opening and the light will stay turned on as you're moving around in the corridor .
As I said I divided my projects into 2 parts , So I created my code in 2 phases too . the first time I created the cod for the ultrasonic sensor and servo motor . I included the library ( Ultrasonic.h) and ( Servo .h ) , created my variables and made the servo motor opens when the ultrasonic sensor reads that something is closer than 50 cm and wait for 5 seconds till the person enter the corridor .
the second phase was to code the LED with microwave sensor that the LED turns on when the Microwave sensor reads that the door moved and it will be turned on as the person is moving in the corridor .
I used 2 libraries to create this code . ( ultrasonic.h & servo.h )
It's my first time to code using Texts only so I had to search a lot and read more to know how to code different sensors .
I also had problems debugging the code ( please check all ; and "" in your code and don't forget capital and small letters too . :(
I detected all shawn syntax errors and tried to debug them . I also viewed many code examples from ultrasonic . h library and servo.h library to understand how to deal with these codes .
I created a cardboard prototype that simulate the process of the smart corridor .
ultrasonic and servo motor
Final result