Video:
Description:
We can use 2bit decoder IC's for LED's to reduce usage of Arduino Pins. We can also use 4bit Up/Down Counter for Seven Segment. We use its Down Counter mode. We can use BCD Decoder IC's to decode input bits into Seven segment inputs.=====================================================
Application:
-----) To control Traffic
=====================================================
Software Used:
------) For Arduino Programming ***Arduino IDE****
------) For Simulation ***Proteus***
======================================================
Components:
- · Arduino UNO
- · Seven Segments Common Anode
- · LED’s (Red, Green, Blue/Yellow)
- · 4555 IC’s (2 to 4bit Decoder)
- · 74191 IC’s (4bit Up/Down Counter)
- · 7447 BCD Decoder IC’s
Code:
//Four
Way Traffic Light System With 3Bit Counter Using Arduino UNO
const int south_B1
= 0;
const int south_B2
= 1;
const int east_B1
= 2;
const int east_B2
= 3;
const int west_B1
= 4;
const int west_B2
= 5;
const int north_B1
= 6;
const int north_B2
= 7;
const int clk1 =
11; //Pulse For Timer1/Counter
of North
const int clk2 =
9; //Pulse For
Timer2/Counter of East
const int clk3 =
10; //Pulse For
Timer2/Counter of West
const int clk4 =
8; //Pulse For
Timer2/Counter of South
void setup() {
// put your
setup code here, to run once:
pinMode(north_B1, OUTPUT);
pinMode(east_B1, OUTPUT);
pinMode(west_B1, OUTPUT);
pinMode(south_B1, OUTPUT);
pinMode(north_B2, OUTPUT);
pinMode(east_B2, OUTPUT);
pinMode(west_B2, OUTPUT);
pinMode(south_B2, OUTPUT);
pinMode(clk1, OUTPUT);
pinMode(clk2, OUTPUT);
pinMode(clk3, OUTPUT);
pinMode(clk4, OUTPUT);
update(LOW, LOW, LOW, LOW, LOW, HIGH,
HIGH, LOW);
count(0);
delay(990);
update(LOW, LOW, LOW, LOW, LOW, HIGH,
HIGH, LOW);
count(0);
delay(990);
update(LOW, LOW, LOW, HIGH, HIGH, LOW,
LOW, LOW);
count(1);
delay(990);
update(LOW, LOW, LOW, HIGH, HIGH, LOW,
LOW, LOW);
count(1);
delay(990);
update(LOW, HIGH, HIGH, LOW, LOW, LOW,
LOW, LOW);
count(2);
delay(990);
update(LOW, HIGH, HIGH, LOW, LOW, LOW,
LOW, LOW);
count(2);
delay(990);
update(HIGH, LOW, LOW, LOW, LOW, LOW,
LOW, HIGH);
count(3);
delay(990);
update(HIGH, LOW, LOW, LOW, LOW, LOW,
LOW, HIGH);
count(3);
delay(990);
}
void loop() {
// put your
main code here, to run repeatedly:
update(LOW, LOW, LOW, LOW, LOW, HIGH,
HIGH, LOW);
count(3);
delay(990);
update(LOW, LOW, LOW, LOW, LOW, HIGH,
HIGH, LOW);
count(3);
delay(990);
update(LOW, LOW, LOW, HIGH, HIGH, LOW,
LOW, LOW);
count(3);
delay(990);
update(LOW, LOW, LOW, HIGH, HIGH, LOW,
LOW, LOW);
count(3);
delay(990);
update(LOW, HIGH, HIGH, LOW, LOW, LOW,
LOW, LOW);
count(3);
delay(990);
update(LOW, HIGH, HIGH, LOW, LOW, LOW,
LOW, LOW);
count(3);
delay(990);
update(HIGH, LOW, LOW, LOW, LOW, LOW,
LOW, HIGH);
count(3);
delay(990);
update(HIGH, LOW, LOW, LOW, LOW, LOW,
LOW, HIGH);
count(3);
delay(990);
}
void update(boolean x1, boolean x2, boolean x3, boolean x4, boolean x5, boolean x6, boolean x7, boolean x8)
{
digitalWrite(north_B1, x1);
digitalWrite(north_B2, x2);
digitalWrite(east_B1, x3);
digitalWrite(east_B2, x4);
digitalWrite(west_B1, x5);
digitalWrite(west_B2, x6);
digitalWrite(south_B1, x7);
digitalWrite(south_B2, x8);
}
void count(int tec)
{
if (tec == 0)
{
digitalWrite(clk1, LOW);
digitalWrite(clk2, LOW);
digitalWrite(clk3, LOW);
digitalWrite(clk4, LOW);
delay(10);
digitalWrite(clk1, HIGH);
digitalWrite(clk2, LOW);
digitalWrite(clk3, LOW);
digitalWrite(clk4, LOW);
}
else if (tec == 1)
{
digitalWrite(clk1, LOW);
digitalWrite(clk2, LOW);
digitalWrite(clk3, LOW);
digitalWrite(clk4, LOW);
delay(10);
digitalWrite(clk1, HIGH);
digitalWrite(clk2, LOW);
digitalWrite(clk3, LOW);
digitalWrite(clk4, HIGH);
}
else if (tec == 2)
{
digitalWrite(clk1, LOW);
digitalWrite(clk2, LOW);
digitalWrite(clk3, LOW);
digitalWrite(clk4,
LOW);
delay(10);
digitalWrite(clk1, HIGH);
digitalWrite(clk2, LOW);
digitalWrite(clk3, HIGH);
digitalWrite(clk4, HIGH);
}
else
{
digitalWrite(clk1, LOW);
digitalWrite(clk2, LOW);
digitalWrite(clk3, LOW);
digitalWrite(clk4, LOW);
delay(10);
digitalWrite(clk1, HIGH);
digitalWrite(clk2, HIGH);
digitalWrite(clk3, HIGH);
digitalWrite(clk4, HIGH);
}
}
======================================================
Other Projects:
Four Way Traffic Light System Using Arduino Simple Version
------ https://youtu.be/mJ0ANveFoZ8
Four Way Traffic Light System DLD Project
------ https://youtu.be/Sso0yG1Leq4
=====================================================
AKElevon also Support (If you have any question or you can get help about any project Mail me) and Work in Following Fields.
=====Mail programmer74432@gmail.com====
1- 8051 related Projects
2- Image Processing Using Matlab
3- Electronics Projects
4- Machine Learning
5- Deep Learning
6- Arduino Projects
7- Python and C++ --Window Form--
No comments:
Post a Comment