#define trigPin 9 #define echoPin 10 #define buzzerPin 8 void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(buzzerPin, OUTPUT); Serial.begin(9600); } void loop() { long duration, distance; // Send an ultrasonic pulse to measure distance digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); // Measure the time it takes for the pulse to return duration = pulseIn(echoPin, HIGH); // Calculate distance in centimeters distance = (duration / 2) / 29.1; // Check the distance if (distance < 10) { // If an obstacle is detected within 20cm, sound the buzzer digitalWrite(buzzerPin , HIGH); delay(500); // Buzzer on for half a second digitalWrite(buzzerPin , LOW); } // Print the distance to the serial monitor for debugging Serial.print("Distance: "); Serial.print(distance); Serial.println(" cm"); delay(100); // Wait for a short time before the next measurement }
@@poojadahiya7646#define trigPin 9 #define echoPin 10 #define buzzerPin 8 void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(buzzerPin, OUTPUT); Serial.begin(9600); } void loop() { long duration, distance; // Send an ultrasonic pulse to measure distance digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); // Measure the time it takes for the pulse to return duration = pulseIn(echoPin, HIGH); // Calculate distance in centimeters distance = (duration / 2) / 29.1; // Check the distance if (distance < 10) { // If an obstacle is detected within 20cm, sound the buzzer digitalWrite(buzzerPin , HIGH); delay(500); // Buzzer on for half a second digitalWrite(buzzerPin , LOW); } // Print the distance to the serial monitor for debugging Serial.print("Distance: "); Serial.print(distance); Serial.println(" cm"); delay(100); // Wait for a short time before the next measurement }
#define trigPin 9 #define echoPin 10 #define buzzerPin 8 void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(buzzerPin, OUTPUT); Serial.begin(9600); } void loop() { long duration, distance; // Send an ultrasonic pulse to measure distance digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); // Measure the time it takes for the pulse to return duration = pulseIn(echoPin, HIGH); // Calculate distance in centimeters distance = (duration / 2) / 29.1; // Check the distance if (distance < 10) { // If an obstacle is detected within 20cm, sound the buzzer digitalWrite(buzzerPin , HIGH); delay(500); // Buzzer on for half a second digitalWrite(buzzerPin , LOW); } // Print the distance to the serial monitor for debugging Serial.print("Distance: "); Serial.print(distance); Serial.println(" cm"); delay(100); // Wait for a short time before the next measurement } 1:29 1:30
MashaALLAH ❤
Well-done ❤
Well done
Hlo you pdf is not opening in my phone can u give me screenshot
#define trigPin 9
#define echoPin 10
#define buzzerPin 8
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzerPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
long duration, distance;
// Send an ultrasonic pulse to measure distance
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Measure the time it takes for the pulse to return
duration = pulseIn(echoPin, HIGH);
// Calculate distance in centimeters
distance = (duration / 2) / 29.1;
// Check the distance
if (distance < 10) {
// If an obstacle is detected within 20cm, sound the buzzer
digitalWrite(buzzerPin , HIGH);
delay(500); // Buzzer on for half a second
digitalWrite(buzzerPin , LOW);
}
// Print the distance to the serial monitor for debugging
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(100); // Wait for a short time before the next measurement
}
Bro but also the trigpin comes ERROR what I want to do bro reply bro @@Iphone2007kl
8:39
bhai code, google drive access denied ho raha.
Hello bro, I want to ask if you don't have problems with your 9V battery getting hot and running out quickly?
No
Ye material total ktny Ka Mila tha ?? Ktny bgut me??
Approximate 3000
AsalamuAlaikum. i made the project and uploaded the code but it is only beeping. What should i do??
Waalaikum salam! Please make sure all the wires is properly and correctly connected
@@thewiredworldofqasimit turned out that my ultrasonic sensor was faulty. Thanks for the advice though!
@@MUHAMMADSHAYAN13905bro aapka aurdino ka cost kitna lga or konsa Arduino purchase karna hai kya aap help kar sakte ho
Plz give me name of all the parts
Arduino uno
Buzzer
Ultrasonic Sensor
9v battery
If you have any query feel free to comment again
the drive is not opening bro
drive.google.com/file/d/1GJ31J-Fff5lZGHhr67eKISNBFZydq6S_/view?usp=drivesdk
version of arduino
UNO
The code is not opening can u please send that code i have to do this project
drive.google.com/file/d/1GJ31J-Fff5lZGHhr67eKISNBFZydq6S_/view?usp=drivesdk
@@thewiredworldofqasim this code is still unopened please 🥺 help
@@poojadahiya7646#define trigPin 9
#define echoPin 10
#define buzzerPin 8
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzerPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
long duration, distance;
// Send an ultrasonic pulse to measure distance
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Measure the time it takes for the pulse to return
duration = pulseIn(echoPin, HIGH);
// Calculate distance in centimeters
distance = (duration / 2) / 29.1;
// Check the distance
if (distance < 10) {
// If an obstacle is detected within 20cm, sound the buzzer
digitalWrite(buzzerPin , HIGH);
delay(500); // Buzzer on for half a second
digitalWrite(buzzerPin , LOW);
}
// Print the distance to the serial monitor for debugging
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(100); // Wait for a short time before the next measurement
}
Bro i need code please
#define trigPin 9
#define echoPin 10
#define buzzerPin 8
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzerPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
long duration, distance;
// Send an ultrasonic pulse to measure distance
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Measure the time it takes for the pulse to return
duration = pulseIn(echoPin, HIGH);
// Calculate distance in centimeters
distance = (duration / 2) / 29.1;
// Check the distance
if (distance < 10) {
// If an obstacle is detected within 20cm, sound the buzzer
digitalWrite(buzzerPin , HIGH);
delay(500); // Buzzer on for half a second
digitalWrite(buzzerPin , LOW);
}
// Print the distance to the serial monitor for debugging
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(100); // Wait for a short time before the next measurement
} 1:29 1:30
Shock
What is code
8:39
8:39