//=================================================================
// Project : Use human sensor
//
// Date : 2019-03-12
// Version : 1.0
//
// Note:
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY : without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
//
// Hardware
// 1. Arduino UNO
// 2. I2C LCM (PCF8574A)
// 3. Human sensor
//=================================================================
#include "LiquidCrystal_I2C.h"
// PCF8574 - 0x27
// PCF8574A - 0x3F
#define LCM_I2C_ADDRESS 0x3f
LiquidCrystal_I2C lcd(0x27, 16,2);
#define HUMAN_SENSOR_PIN 2
//====================================================
void setup()
{
Serial.begin(9600);
pinMode(HUMAN_SENSOR_PIN, INPUT); // set pin to input
digitalWrite(HUMAN_SENSOR_PIN, HIGH); // turn on pullup resistors
lcd.begin(16,2);
lcd.clear();
lcd.print("Human sensor");
lcd.setCursor(0,1);
lcd.print("Demo 001");
delay(2000);
}
void loop()
{
int value = digitalRead(HUMAN_SENSOR_PIN);
lcd.setCursor ( 0, 1 ); // go to the next line
if (value==1)
lcd.print("> Found <");
else
lcd.print("> ----- <");
delay(200);
}