GadhaGod
Published © MIT

Using the Ultrasonic Distance Sensor the Easy Way!

Make usage of the HC-SR04 as easy as blinking an LED!

BeginnerFull instructions provided832
Using the Ultrasonic Distance Sensor the Easy Way!

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

ezdist_example_circuit_D2lea0Jkkm.png

Code

Centimeters

C/C++
#include <EZDist.h>

int trigPin = 12;
int echoPin = 11;

EZDist EZDist(trigPin, echoPin);

void setup() {
 Serial.begin(9600);
}
void loop() {
 Serial.println(EZDist.cm()); 
}

Credits

GadhaGod
17 projects • 20 followers
Contact

Comments

Please log in or sign up to comment.