4. Units Operation

4. PIR sensor

126 views 2019-06-04 peterletintech 0

Hardware requirement

  • M5GO
  • PIR sensor
  • Connecting wire

passive infrared sensor (PIR sensor) is an electronic sensor that measures infrared (IR) light radiating from objects in its field of view. They are most often used in PIR-based motion detectors.

Step 1. Plugin the PIR sensor unit.

Step 2. Choose “loop” block and “if do else” block under the Setup block.

Step 3. Drag the “PIR” block into “if do else” block. If the PIR sensor senses something, it will return true. The program will run “do”. In contrast, it will return false. The program will run “else”.

Step 4. Drag the RGB bar to the “if do else” block. In this case, when the sensor senses something, it will show red RGB light. Else will show nothing.

Step 5. Plug the sensor in port B.

Step 6. Execute it and finish. (Click the graph and see the result)

Was this helpful?