#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);

float cm;
float inches;
//int triggerPin=3;
//int echoPin=2;

long readUltrasonicDistance(int triggerPin, int echoPin)
{
	pinMode(triggerPin, OUTPUT);  // Clear the trigger
	digitalWrite(triggerPin, LOW);
	delayMicroseconds(2);
	// Sets the trigger pin to HIGH state for 10 microseconds
	digitalWrite(triggerPin, HIGH);
	delayMicroseconds(10);
	digitalWrite(triggerPin, LOW);
	pinMode(echoPin, INPUT);
	// Reads the echo pin, and returns
	// the sound wave travel time in microseconds
	return pulseIn(echoPin, HIGH);
}


void setup() 
{
  //pinMode( 13, OUTPUT);     
  Serial.begin(115200);  
  //Serial.write("dooda ");
  lcd.init();	// initialize the lcd
  // setup LCD.
  lcd.backlight();  
	lcd.clear();  
}

void loop() 
{
  //digitalWrite(13,HIGH);  
  //readUltrasonicDistance(3, 2);
  
 
  delay(500);
  lcd.setCursor(0,0);
  lcd.print(readUltrasonicDistance(3, 2));
  

}