Arduino PIR sensor

Featured Video Play Icon
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
int ledPin = 13;
int pirPin = 9;
int val = 0;

void setup()
{
  pinMode (ledPin,OUTPUT);
  pinMode (pirPin, INPUT);
}
void loop ()
{
  val = digitalRead(pirPin);
  digitalWrite(ledPin,val);

if (val == 1)
  digitalWrite(ledPin,LOW);
}

Leave a Reply

Your email address will not be published. Required fields are marked *