Automatic Gate – Coding

Let’s make a gate that opens automatically when something arrives. In this project, we will use conditional instructions, servo motors, distance sensor and LEDs.

Connecting electronic modules

  • Distace sensor → Distance port.
  • Servo motor → OUTPUT1.
  • Green LED → OUTPUT3.
  • Red LED → OUTPUT4.
  • Power supply → USB cable → computer.

The code