Motion Sensor

../../_images/pk_pir.jpg
Motion Sensor

Description

A PIR (Passive Infrared) Sensor measures IR Light radiating from objects.

Typically used in applications such as motion lights and alarms.

Usage

This sensor reads the amount of PIR energy to trigger a digital output.

Voltage Range

2.7 - 3.3V

Interface Type

Digital Input

Example Usage

from microbit import *

while True:
  motion_val = pin0.read_digital()

  if motion_val == 1:
    # motion is detected
    # ...do something
  else:
    # motion is NOT detected
    # ...do something