Project Name: Serial Monitor

Aim of the project: Get the Variant Value of distance meter(Ultrasonic)

Component:

  • Arduino
  • Ultrasonic
  • LEDs
  • Jumper Wire

Circuit Diagram:

Code:

#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);
}

Video: