[Project 2] – LED භාවිතා කර Traffic Lights එකක් හදමු.

You are here:
  • KB Home
  • Arduino
  • [Project 2] – LED භාවිතා කර Traffic Lights එකක් හදමු.
Estimated reading time: < 1 min

In this project we will make an example of traffic lights. I will use arduino mega 2560. You can use the other arduino cards. This project for beginners.

Materials:

  1. Arduino Mega 2560 / Other Arduino Cards   x 1
  2. Breadboard    x 1
  3. 220 ohm resistor    x 3
  4. Green LED    x 1
  5. Yellow LED     x 1
  6. Red LED    x 1
  7. Jumper Cable

Program:

// Projet 2 - Traffic Lights

int redLedDelay = 10000;
int greenLedDelay = 10000;
int redLed = 7;
int yellowLed = 6;
int greenLed = 5;

void setup(){
 pinMode(redLed, OUTPUT);
 pinMode(yellowLed, OUTPUT);
 pinMode(greenLed, OUTPUT);
}

void loop(){
 
 digitalWrite(redLed, HIGH);
 delay(redLedDelay);
 
 digitalWrite(yellowLed, HIGH);
 delay(2000);
 
 digitalWrite(redLed, LOW);
 digitalWrite(yellowLed, LOW);
 digitalWrite(greenLed, HIGH);
 delay(greenLedDelay);
 
 digitalWrite(yellowLed, HIGH);
 digitalWrite(greenLed, LOW);
 delay(2000);
 
 digitalWrite(yellowLed, LOW);
 
 }

Traffic Lights To Work In This Way:

Project Related Images

 

Tags:
Was this article helpful?
Dislike 0
Views: 695

Leave a Reply

Your email address will not be published. Required fields are marked *