
www.diymalls.com [email protected]
DIYmall HC-SR505 Motion Sensor for Arduino
What you need:
1 X HC-SR505 Motion Sensor
1 X Arduin UNO
1 X 3P Jumper Wire
1 X LED
Connection:
- to GND
out to D7
+ to 5V
Red LED long leg to D13
Red LED short leg to GNC
Code:
int SR505=7;
int LED=13;
void setup()
{
pinMode(LED,OUTPUT);
pinMode(SR505,INPUT);
Serial.begin(9600);
}
void loop()
{
if(digitalRead(SR505)==HIGH)

www.diymalls.com [email protected]
{
Serial.println("Enter The Sensing Area ");
digitalWrite(LED,HIGH);
delay(10);
digitalWrite(LED,LOW);
delay(10);
}
else
{
Serial.println("NO Man");
digitalWrite(LED,LOW);
}
delay(500);
}
Result:

