Skip to content

Commit

Permalink
Initial project
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitpatawat committed Oct 5, 2021
1 parent 1dbb376 commit 1670d49
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 1 deletion.
Binary file added Obstacle sensor/image_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Obstacle sensor/image_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Obstacle sensor/image_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Obstacle sensor/image_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Obstacle sensor/obstacle_detector.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
int trigger_pin = 2;
int echo_pin = 3;
//int buzzer_pin = 10;
int time;
int distance;
void setup()
{
Serial.begin (9600);
pinMode (trigger_pin, OUTPUT);
pinMode (echo_pin, INPUT);
// pinMode (buzzer_pin, OUTPUT);
}
void loop()
{
digitalWrite (trigger_pin, HIGH);
delayMicroseconds (10);
digitalWrite (trigger_pin, LOW);
time = pulseIn (echo_pin, HIGH);
distance = (time * 0.034) / 2;

if (distance <= 10)
{
Serial.println ("Very close to sensor! ");
// digitalWrite (buzzer_pin, HIGH);
delay (500);
}
else {
Serial.println ("Obstacle detected");
Serial.print (" Distance = ");
Serial.println (distance);
// digitalWrite (buzzer_pin, LOW);
delay (500);
}
}
Binary file added Obstacle sensor/obstacle_detector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Obstacle sensor/readme.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@

Obstacle detector - in this project, we made an obstacle detector using arduino and ultra sonic sensor.when we start our porgram, our ultrasonic sensor will be powered on and when any object comes in its range, then we will display "Obstacle detected" along with the distance of object from the sensor.

0 comments on commit 1670d49

Please sign in to comment.