Robot Head – Alarm

If too often someone surprises you when you’re learning robot programming, today’s lesson is just right for you! We will learn how to build a robot that will serve as an alarm. The robot will be able to alert you thanks to the diodes and the loud buzzer sound, and will also shake his head when he detects the intruder.

Connecting electronic modules

  • Light sensor → INPUT1.
  • Distance sensor → port Distance.
  • Servo → OUTPUT1. For DC motor version: Motor 1 → M1, Motor 2 → M2.
  • LED → OUTPUT3.
  • LED → OUTPUT4.
  • Power → USB cable → computer.

The code