ARDUINO CODE FOR PIR SENSOR
int val=0;
#define led 13
void setup()
{
Serial.begin(9600);
pinMode(led,OUTPUT);
}
void loop()
{
val=digitalRead(3);
if (val==HIGH){
digitalWrite(led,HIGH);
Serial.println("motion is detected");
}
if(val==LOW){
digitalWrite(led,LOW);
delay(50);
Serial.println("nothing is detected");
}
}
Comments
Post a Comment