#include <LiquidCrystal.h>
LiquidCrystal lcd(3,4,5,6,7,8);
const int echo = 10, trig = 9, ir = 11;
void setup() {
// put your setup code here, to run once:
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
// pinMode(ir, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
// lcd.print("Hello");
lcd.setCursor(0,0);
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
float t, d;
t = pulseIn(echo, HIGH);
d = (t * 0.0343)/2;
lcd.print("distance : ");
lcd.print(d);
// int c = digitalRead(ir);
// if (ir == 0) {
// lcd.setCursor(1,0);
// lcd.print("Object detected");
// }
// else {
// lcd.setCursor(1,0);
// lcd.print("no object detected");
// }
}