#include<LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
#define trigPin 3
#define echoPin 2
#define SDAPin A4
#define SCLPin A5
int jarak;
long durasi;
void setup()
{
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
lcd.init();
lcd.backlight();
}
void loop()
{
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
durasi=pulseIn(echoPin,HIGH);
jarak = durasi*0,034/2;
lcd.setCursor(0,0);
lcd.print("jarak=");
lcd.print(jarak);
lcd.print("cm");
delay(50);
}