Buzzer wala Traffic Signal, Lesson 8 B – Ejaad Box: Arduino Starter Kit

Buzzer wala Traffic Signal, Lesson 8 B - Ejaad Box: Arduino Starter Kit

Agar traffic signal say awaaz aati jab chalnay ka time hota to kitna maza aata
What if Traffic Signals made some sound when it was time to GO!, so, let’s make one.

In this lesson, we will add a Buzzer to our Traffic Signal – we will use the same circuit and code used in the previous lesson, Lesson 8 A and add a Buzzer to it.

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); 
    
}
SCHEMATIC - TO DO

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?