Playback starts YouTube’s embedded player (privacy-enhanced mode).
How To: Use an Arduino with an Ultrasonic Sensor (HC-SR04)
ChannelnonscioDescription from the creator
This video is about using the popular HC-SR04 Ultrasonic Sensor with an Arduino Uno to make distance measurements. You can use these measurements in many applications from robot object avoidance to parking sensors.
For more information see this post: nonscio.com/blog/q9gjkd7zg5llfkp0ghnfwecqy2oxas
See how this can be used to help a robot navigate autonomously! youtu.be/IvulErD05rA
#define echoPin 7
#define trigPin 8
long duration;
long distance;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(echoPin,INPUT);
pinMode(trigPin,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(trigPin,LOW);
delayMicroseconds(2);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
duration = pulseIn(echoPin,HIGH);
distance = duration/58.2;
Serial.print(distance);
delay(50);
}
For more information see this post: nonscio.com/blog/q9gjkd7zg5llfkp0ghnfwecqy2oxas
See how this can be used to help a robot navigate autonomously! youtu.be/IvulErD05rA
#define echoPin 7
#define trigPin 8
long duration;
long distance;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(echoPin,INPUT);
pinMode(trigPin,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(trigPin,LOW);
delayMicroseconds(2);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
duration = pulseIn(echoPin,HIGH);
distance = duration/58.2;
Serial.print(distance);
delay(50);
}
About this tutorial
nonscio published this 3:06 video tutorial on November 8, 2017. It has been watched 68,893 times on YouTube.
- Channel
- nonscio
- Category
- Howto & Style
- Duration
- 3:06
- Published
- November 8, 2017
- Views
- 68,893
- Likes
- 415
Tags
Share
This tutorial in other languages
- FRComment faire pour utiliser un Arduino avec un capteur à ultrasons (HC-SR04)
- ESCómo: Usar un Arduino con un sensor ultrasónico (HC-SR04)
- PTComo: usar um Arduino com um sensor de ultra-som (HC-SR04)
- ITProcedura: utilizzare un Arduino con un sensore ad ultrasuoni (HC-SR04)
- DEHow To: Verwenden Sie einen Arduino mit einem Ultraschallsensor (HC-SR04)
- NLHow To: Gebruik een Arduino met een ultrasone sensor (HC-SR04)
- RUКак: Использовать Arduino с ультразвуковым датчиком (HC-SR04)
- PLJAK: Korzystanie z Arduino z czujnik ultradźwiękowy (HC-SR04)
- JA方法:超音波センサ(HC-SR04)で使用アルドゥイーノ
- ARHOW TO: استخدام اردوينو مع الاستشعار بالموجات فوق الصوتية (HC-SR04)
- HIकैसे: एक अल्ट्रासोनिक सेंसर (एचसी-SR04) के साथ उपयोग के लिए एक Arduino
- IDCara: Gunakan Arduino dengan Ultrasonic Sensor (HC-SR04)