// include the library code:
#include <LiquidCrystal.h>
#define ir 6
// initialize the library by associating any needed LCD pin
// with the arduino pin number it is connected to
const int r5 = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(r5, en, d4, d5, d6, d7);
void setup() {
// set up the LCD's number of columns and rows:
pinMode(ir, INPUT);
lcd.begin(16, 2);
// print a message to the LCD.
lcd.print("The IR reads");
}
void loop() {
bool sensor = digitalRead(ir);
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// lcd.print(sensor);
if (sensor == 0) {
lcd.print("THERE IS NO INTRUDER!!!");
}
else (sensor == 1); {
lcd.print("NO INTRUDER");
}
}