Back to Parent

//Initial test for pirSensor

int PIRsensor = D4;
int ledPin = D2;
int value = 0;

void setup(){
  pinMode(PIRsensor, INPUT);
  pinMode(ledPin, OUTPUT);

  Serial.begin(9600);
}

void loop(){
  value = digitalRead(PIRsensor);
  if (value == HIGH){
    digitalWrite(ledPin,HIGH);
  }
  else{
    digitalWrite(ledPin,LOW);
  }
}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0