Traffic Light Arduino Project | Arduino Code Control Traffic Light Video Tutorial

Опубликовано: 06 Октябрь 2024
на канале: Brief-Biography
15,261
154

Code Traffic Light
------------------------------------------------------
int red1 = 13;
int yellow1 = 12;
int green1 = 11;

int red2 = 10;
int yellow2 = 9;
int green2 = 8;

void setup() {
// put your setup code here, to run once:
pinMode(red1,OUTPUT);
pinMode(yellow1,OUTPUT);
pinMode(green1,OUTPUT);

pinMode(red2,OUTPUT);
pinMode(yellow2,OUTPUT);
pinMode(green2,OUTPUT);

}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(red2,HIGH);
digitalWrite(green1,HIGH);
delay(10000); // 10 second

digitalWrite(green1,LOW);
digitalWrite(yellow1,HIGH);
delay(3000); // 3 second

digitalWrite(red2,LOW);
digitalWrite(yellow1,LOW);
digitalWrite(green2,HIGH);
digitalWrite(red1,HIGH);
delay(10000); // 10 second

digitalWrite(green2,LOW);
digitalWrite(yellow2,HIGH);
delay(3000); // 3 second

digitalWrite(yellow2,LOW);
digitalWrite(red1,LOW);

}
------------------------------------------------------

Thank for watch. If you want get more videos arduino tutorial visit my channel.

Copyright by YouTube Channel: Thona Tann