Arduino Project
Arduino Automatic Barrier Gate Project with Ultrasonic Sensor V3
Course Introduction
In this lesson, you’ll use a button, a traffic light LED module, and a servo motor with the Arduino to simulate a manual barrier gate system.
When the button is pressed, the red light turns off, the green light turns on, and the gate opens briefly to let a car pass.
Note
If this is your first time working with an Arduino project, we recommend downloading and reviewing the basic materials first.
1.1 Install Arduino IDE(Important)
1.2 Introduction of Arduino IDE
Wiring

Common Connections:
LED
Connect the LEDs cathode to the negative power bus on the breadboard, and the LEDs anode to a 1kΩ resistor then to 3, 4 on the Arduino.
Digital Servo Motor
Connect to breadboard’s positive power bus.
Connect to breadboard’s negative power bus.
Connect to 11 on the Arduino.
Button
Connect to breadboard’s negative power bus.
Connect to 2 on the Arduino.
Writing the Code
Note
You can copy this code into Arduino IDE.
Don’t forget to select the board(Arduino UNO R4 WIFI) and the correct port before clicking the Upload button.
