#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); //create object of lcd
#include <HCSR04.h>
UltraSonicDistanceSensor hc(4, 3);
void setup() {
// put your setup code here, to run once:
lcd.init();
lcd.backlight();
}
void loop() {
// put your main code here, to run repeatedly:
if (hc.measureDistanceCm() > 100 || hc.measureDistanceCm() >= 400) {
lcd.println("...");
Serial.println("...");
}
else if (hc.measureDistanceCm() >= 50) {
lcd.print("Who's there?");
Serial.println("Who's there?");
}
else if (hc.measureDistanceCm() < 20) {
lcd.print("how can i help you?");
Serial.println("how can i help you?");
}
delay(100);
}