Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Shahir nasar
Published © GPL3+

Ultrasonic Sensor

This project shows you how to use the Ultrasonic for meter distance.

IntermediateShowcase (no instructions)3 minutes8,377
Ultrasonic Sensor

Things used in this project

Hardware components

Adafruit ultrasonic
×1
Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

circuit diagram

Code

Ultrasonic code for distance meter

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

const int TriggerPin = 11;
const int EchoPin = 12;

NewPing sonar(TriggerPin, EchoPin, 100);

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

void loop() {
  int cm = sonar.ping_cm();
  Serial.println(cm);
  delay(250);
}

Credits

Shahir nasar
0 projects • 4 followers
Entrepreneur | Founder and CEO of Holse Products
Contact

Comments

Please log in or sign up to comment.