Home

How to Use the Grove PIR Motion Sensor

This sensor drives its output signal high for about a second when motion is detected. You can read an Arduino digital pin connected to the sensor output signal to detect motion from an Arduino sketch.

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(2, INPUT);
}

void loop()
{
  // Flash the LED whenever motion is detected
  digitalWrite(LED_BUILTIN, digitalRead(2));
}

Home


Questions or comments to phil@munts.net