Arduino traffic light system and LED blinking

3 years ago
12

Blinking Led:int ledb = 13;
int ledr = 12;
int ledg = 11;

void setup(){
pinMode(ledb, OUTPUT);
pinMode(ledr, OUTPUT);
pinMode(ledg, OUTPUT);
}

void loop(){
digitalWrite(ledb, HIGH);
digitalWrite(ledr, HIGH);
digitalWrite(ledg, HIGH);
delay(500);
digitalWrite(ledb, LOW);
digitalWrite(ledr, LOW);
digitalWrite(ledg, LOW);
delay(500);
}int ledb = 13;
int ledr = 12;
int ledg = 11;

void setup(){
pinMode(ledb, OUTPUT);
pinMode(ledr, OUTPUT);
pinMode(ledg, OUTPUT);
}

void loop(){
digitalWrite(ledb, HIGH);
digitalWrite(ledr, HIGH);
digitalWrite(ledg, HIGH);
delay(500);
digitalWrite(ledb, LOW);
digitalWrite(ledr, LOW);
digitalWrite(ledg, LOW);
delay(500);
}

Traffic Light:int ledg = 11;
int ledb = 13;
int ledr = 12;

void setup(){
pinMode(ledg, OUTPUT);
pinMode(ledb, OUTPUT);
pinMode(ledr, OUTPUT);
}

void loop(){
digitalWrite(ledg, HIGH);
delay(3000);
digitalWrite(ledg, LOW);
digitalWrite(ledb, HIGH);
delay(1000);
digitalWrite(ledb, LOW);
digitalWrite(ledr, HIGH);
delay(5000);
digitalWrite(ledr, LOW);
}

Edited by Wondershare Filmora

Loading 1 comment...