How to Make a Traffic Light with Arduino Uno |

Описание к видео How to Make a Traffic Light with Arduino Uno |

Hey! In this video, I'll show you how to create a simple traffic light using an Arduino Uno, some LEDs, and a breadboard. We'll be using the following components:

1. Arduino Uno
2. Male-to-Male Jumper Wires
2. Green, Yellow, and Red LEDs
3. Breadboard
4. Arduino USB Cable
5. Resistor

I'll guide you through the step-by-step process of assembling the circuit and programming the Arduino to control the traffic light sequence. By the end of this video, you'll have a fully functional traffic light that you can use for various projects or just for fun.

Arduino Code:

// Code variables, contants, ints:
int green_led = 2;
int yellow_led = 3;
int red_led = 4;

void setup()
{
pinMode(green_led, OUTPUT);
pinMode(yellow_led, OUTPUT);
pinMode(red_led, OUTPUT);
}

void loop()
{
digitalWrite(red_led, HIGH);
delay(5000); // 5 seconds
digitalWrite(red_led, LOW);

digitalWrite(yellow_led, HIGH);
delay(3000); // 3 Seconds
digitalWrite(yellow_led, LOW);

digitalWrite(green_led, HIGH);
delay(4000); // 4 Seconds
digitalWrite(green_led, LOW);
}

Комментарии

Информация по комментариям в разработке