Skip to main content

Arduino code(social distancing device)

 //SOCIAL DISTANCING DEVICE BY EIP TECH (SHRIYANSH)


#define trigPin 13


#define echoPin 12


#define motor 7


#define buzzer 6


void setup()

{

pinMode(trigPin, OUTPUT);


pinMode(echoPin, INPUT);


pinMode(motor, OUTPUT);


pinMode(buzzer,OUTPUT);


}


void loop()


{


long duration, distance;


digitalWrite(trigPin, LOW);


delayMicroseconds(2);


digitalWrite(trigPin, HIGH);


delayMicroseconds(10);


digitalWrite(trigPin, LOW);


duration = pulseIn(echoPin, HIGH);


distance = (duration/2) / 29.1;


if (distance < 130)     // This is where checking the distance you can change the value


{


digitalWrite(motor,HIGH);    // When the the distance below 100cm


digitalWrite(buzzer,HIGH);

delay(100);

digitalWrite(buzzer,LOW);

delay(100);


} else


{


digitalWrite(motor,LOW);     // when greater than 100cm


digitalWrite(buzzer,LOW);


} delay(30);


}

Comments

Popular posts from this blog

RPM meter || CIRCUIT DIAGRAM

Watch full video on YouTube Eip tech click on me (my channel)

POV Display On Cycle Code🔥

// Yeh Code Kam Karne Ke Liye Subscribe Kare 👉 //Www.youtube.com/c/eiptech int NUMBER9[]={1,1,1,1,0,0,0,1, 1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1, 1,1,1,1,1,1,1,1}; int NUMBER8[]={0,1,1,0,1,1,1,0, 1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1, 0,1,1,0,1,1,1,0}; int NUMBER7[]={1,0,0,0,0,0,0,0, 1,0,0,0,1,0,0,0, 1,0,0,0,1,0,0,0, 1,0,0,1,1,1,1,1, 1,1,1,0,1,0,0,0}; int NUMBER6[]={1,1,1,1,1,1,1,1, 1,0,0,0,1,0,0,1, 1,0,0,0,1,0,0,1, 1,0,0,0,1,0,0,1, 1,0,0,0,1,1,1,1}; int NUMBER5[]={1,1,1,1,1,0,0,1, 1,0,0,0,1,0,0,1, 1,0,0,0,1,0,0,1, 1,0,0,0,1,0,0,1, 1,0,0,0,1,1,1,1}; int NUMBER4[]={1,1,1,1,0,0,0,0, 0,0,0,1,0,0,0,0, 0,0,0,1,0,0,0,0, 0,0,0,1,0,0,0,0, 1,1,1,1,1,1,1,1}; int NUMBER3[]={1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1, 1,1,1,1,1,1,1,1}; int NUMBER2[]={1,0,0,0,0,0,1,1, 1,0,0,0,0,1,0,1, 1,0,0,0,1,0,0,1, 1,0,0,1,0,0,0,1, 0,1,1,0,0,0,0,1}; int NUMBER1[]={0,0,1,0,0,0,0,0, 0,1,0,0,0,0,0,0, 1,1,1,1,1,1,1,1, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0}; int N...

Smart Study Table Circuit Diagram