// Motion sensor(HC-SR501) test #include #define SENSOR_PIN 4 LiquidCrystal_I2C lcd(0x27,16,2); String motion; void setup() { lcd.init(); lcd.backlight(); lcd.setCursor(0, 0); lcd.print("COSMOLIGHT"); lcd.setCursor(0, 1); lcd.print("Project Arduino"); pinMode(SENSOR_PIN, INPUT); delay(3000); } void loop() { int motionCheck = digitalRead(SENSOR_PIN); if (motionCheck == 0) { motion = "WAIT"; } else { motion = "DETECT"; } // data ---> LCD lcd.clear(); lcd.setCursor(0, 0); lcd.print("Motion sens:"); lcd.setCursor(0, 1); lcd.print(motion); delay(1000); }