#include <LiquidCrystal.h>
LiquidCrystal lcd(11, 10, 7, 6, 5, 4);
void setup() {
// put your setup code here, to run once:
lcd.begin(16, 2);
lcd.print("Hello, Arduino!");
pinMode(13, OUTPUT);
pinMode(2, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int x = digitalRead(2);
if (x == 0){
digitalWrite(13, LOW);
Serial.println("No Object");
delay(500);
} else {
digitalWrite(13, HIGH);
Serial.println("Object Detected");
delay(1000);
}
}