Smart Traffic Signal, Lesson 8 A – Ejaad Box: Arduino Starter Kit

Smart Traffic Signal, Lesson 8 A - Ejaad Box: Arduino Starter Kit

Aik aisa Traffic Signal jisko ham control kar sakain aor apni marzi say traffic ko control karain. A traffic Signal with which we can control traffic as we like, c’mon, lets make one!

In this lesson, we will make a Traffic Signal – we will use the same principles as LEDs and use different codes to make lights blink like a Traffic Signal, an ideal project for school and science fair.

int redled = 13; 
int yellowled = 11; 
int greenled = 10;
int buzz = 3; 

void setup() {
  // put your setup code here, to run once:
  pinMode (redled, OUTPUT); 
  pinMode (yellowled, OUTPUT); 
  pinMode (greenled, OUTPUT); 
  pinMode (buzz, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
    digitalWrite(greenled,LOW); 
    digitalWrite(buzz,LOW);
    digitalWrite(yellowled,LOW);
    digitalWrite(redled,HIGH); 
    delay(2000); 

    digitalWrite(redled,LOW);  
    digitalWrite(yellowled,HIGH); 
    digitalWrite(buzz,HIGH);
    delay(500); 

    digitalWrite(yellowled,LOW);
    digitalWrite(greenled,HIGH); 
    delay(1000);     
}

If you have any questions, queries or comments, please post a comment here or on our Pop Up Learning Network group https://www.facebook.com/groups/PopUpLearningpk

You Might Also Like

× How can I help you?