S6 Makerspace (Distance Alarm)

Introduction: S6 Makerspace (Distance Alarm)

We did a Distance Sensor, that buzzes when anything is 15 cm close to the Distance Sensor, the use of our project is when you need privacy on your room, when someone enter your room, the buzzer is going to Buzz.

Step 1: Add the Coding on the Arduino Board

Coding:

int duration:

int distance:

int const trigPin = 9;

int const echoPin = 10;

int buzzer = 2;

void setup( ){

pinMode(trigPin , OUTPUT);

pinMode( echoPin , INPUT);

pinMode( buzzer , OUTPUT);

}

void loop( ){ digitalWrite(trigPin, HIGH); delay(2);

digitalWrite(trigPin, LOW);

duration = pulseIn (echoPin , HIGH);

distance = (duration * 0.034)/2; if(distance < 15){ digitalWrite(2, HIGH);

}

else{ digitalWrite(2, LOW);

}

}

Step 2: Materials Used:

- An Arduino Board

- A Buzzer (5-Volt)

- A Distance Sensor

- 6 Female & 6 Male Wires

- The Arduino Programs

Step 3: Copy the Image Below Using the Correct Materials

Be the First to Share

    Recommendations

    • Organization Contest

      Organization Contest
    • Plastic Challenge

      Plastic Challenge
    • Halloween Contest

      Halloween Contest

    Comments