/*This program test PIR motion sensor. If the sensor detects
movement, The led will turn on.
Probably, you need to calibrate the PIR sensor.*/
int led = 13;
int sensor = 4;
int value = 0;
void setup() {
pinMode(led,OUTPUT);
pinMode(sensor,INPUT);
Serial.begin(9600);
}
void loop() {
value=digitalRead(sensor);//Read the value of digital output on sensor
//If the value read is HIGH turn on led and
//Writes "I see you: " on Serial monitor
if(value==HIGH){
digitalWrite(led,HIGH);
Serial.print("I see you: ");
Serial.println(value);
}
// If the value is low turn off led adn Writes "I not see you: "
else{
digitalWrite(led,LOW);
Serial.print("I not see you: ");
Serial.println(value);
}
}