MakeBlock - Motion Sensor


  • To learn how to activate the motion sensor(Passive Infra-Red) to control output devices like motors, speakers and lights. Your job today will be to build an alarm system. Using the motion sensor, code the robot to move, make sound and flash it's lights when it detects movement.


  1. Use the sample code as your starting point. Connect the PIR (Motion Sensor) to port 6.
  2. The sample code will teach you how to activate the PIR sensor and set it to trigger the motors.
  3. Create your own code that causes the PIR sensor to trigger sound and lights. Your job is to make a custom alarm system. Perhaps you want to use the RGB Light module? How can you make it "younique"?
  4. Post a picture of your code (using Snipping Tool) and a video of your alarm in action to FreshGrade.