#include <NewPing.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
// NewPing sensor(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE)
NewPing sensor(10,11,450);
float jarak;
void setup() {
// put your setup code here, to run once:
lcd.begin(16,2);
}
void loop() {
// put your main code here, to run repeatedly:
jarak=sensor.ping_cm();
lcd.setCursor(0,0);
lcd.print("jarak: ");
lcd.setCursor(0,1);
lcd.print(jarak);
lcd.print(" cm ");
delay(1000);
}