Загрузка страницы

HOW TO: Measure distance wth the Arduino and HC SR04 ultrasonic sensor

In 4 minutes I will show you how to connect a HC-SR04 to an Arduino, program the arduino using the NewPing library and measure distances. This is very easy to connect and can be done with pretty much any arduino.

Here is the github repository:
https://github.com/LessonStudio/Arduino_HC-SR04

Here is the source code:

#include ***LESS THAN BRACKET GOES HERE***NewPing.h ***GREATER THAN BRACKET GOES HERE ***

#define PIN_ECHO 4
#define PIN_TRIG 5
#define MAX_DIST 200

NewPing sensor(PIN_TRIG, PIN_ECHO, MAX_DIST);

void setup()
{
Serial.begin(9600);
}

void loop()
{
delay(250);
int time_taken=sensor.ping();
Serial.println(time_taken/US_ROUNDTRIP_CM);
}

Видео HOW TO: Measure distance wth the Arduino and HC SR04 ultrasonic sensor канала DonovanStudio
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
26 ноября 2015 г. 5:35:00
00:05:33
Яндекс.Метрика