#include <LiquidCrystal.h>
LiquidCrystal lcd(23,22,21,19,18,5);


#define TRIG 12
#define ECHO 13

float duration_us, distance_cm;

void setup(){
  lcd.begin(16,4);
  lcd.print("Loading.");
  delay(500);
  lcd.clear();
  lcd.print("Loading..");
  delay(500);
  lcd.clear();
  lcd.print("Loading...");
  delay(500);
  lcd.clear();
  pinMode(TRIG, OUTPUT);
  pinMode(ECHO, INPUT);

}

void loop(){
  digitalWrite(TRIG, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG, LOW);


  duration_us = pulseIn(ECHO, HIGH);
  distance_cm = 0.017 * duration_us ;

  lcd.setCursor(0,0);
  lcd.print("jarak : ");
  lcd.setCursor(0,1);
  lcd.print(distance_cm);
  lcd.print("cm");
  delay(200);
}