Thanks for Visiting here

About Project:
Hello Guys in this blog post we will discuss Arduino new project in which the Automatic box Oppinig system
![]() |
Automatic Box opening system |
When sone abjects come near the box then the box is automatical open and when objects move from the box the box is automatical closed.
Automatic Box opening system
Last Go to The Projects Automatic Box :
In this project W will need Some Components :
1. Arduino Uno Board
2. Ultrasonic sensor
3. Servo Motor
4. Jumper Wire
5. Cardboard
Last Go to Wiring Parts :
Servo Motor Wiring
Servo Motor | Arduino Uno |
+ | 5v |
- | GND |
S | 8 |
Ultrasonic Sensor Wiring
Ultrasonic sensor | Arduino |
Trig pin | 9 |
Echo pin | 10 |
Vcc | 5v |
GND | Gnd |
Last Jum to The Coding parts
#include<Servo.h>
int servo=8;
int trigPin=9;
int echoPin=10;
int value=0;
long duration;
int distance;
Servo myservo;
void setup()
{
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
myservo.attach(8);
Serial.begin(9600);
}
void loop()
{
digitalWrite(trigPin,LOW);
delayMicroseconds(2);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
duration=pulseIn(echoPin,HIGH);
distance=duration*0.034/2;
Serial.print("Distance is :");
Serial.println(distance);Serial.println("cm");
if(distance<10)
{
myservo.write(90);
}
else
{
myservo.write(0);
}
delay(400);
}
Final Project Video😋
Follow us:
Youtube : https://www.youtube.com/watch?v=2r-J1cXrUzc
Thanks for Reading 😜
Where full coding
ReplyDeleteThanks for comment