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
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
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
HOW TO: Use Lithium 3.7v batteries in small Arduino projects.HOW TO: Develop an iOS C++ app in two days.A comparison of many common Arduino types and their uses.HOW TO: Get an arduino to turn off its own power.HOW TO: Control an Arduino with an iPhone using BLEHOW TO: Use a NRF24L01 + Arduino to remotely control a motorHOW TO: Bluetooth Arduino connecting to Python on desktopHOW TO: Easy GPS connection to an ArduinoHOW TO: Arduino programming via a Raspberry Pi from a PC DesktopHOW TO: Arduino control of DC, Stepper, and servo motorsHOW TO: Unit Test the UI in Cocos2d-x applicationsHOW TO: Sense motion with the Arduino and HC-SR501 Infrared PIR Motion Sensor Detector ModuleEasy TI 84 Plus Operating System UpgradeHOW TO: Quick and Dirty Arduino Mini Programming With FTDI232HOW TO: LM7805 vs LM2940 voltage regulator Comparison plus setup howtoHOW TO: control DC Motors with Arduino + L298NHOW TO: Programming an Arduino ATTiny85 made simple