//JOSHUA NERTEY NETTEY - 1703121001
//ELLIS TEDEKU ASEYE - 1703241942
#include <LCD_I2C.h>
#include <DistanceSensor.h>
// Define pins
const int echoPin = 17;
const int trigPin = 16;
// Start the sensor
DistanceSensor sensor(trigPin, echoPin);
LCD_I2C lcd(0x27, 16, 2); // Default address of most PCF8574 modules, change according
void setup()
{
lcd.begin();
lcd.backlight();
}
void loop()
{
lcd.setCursor(0,1);
float distance = sensor.getCM();
if (distance <= 200) {
lcd.print("There's a car at the gate ");
lcd.print(distance);
lcd.print("cm away");
} else {
lcd.print("No car at the moment");
}
}