7 Segment One Digit Display
1. Objective
The objective of this project is talk about, how to use 7 segment 1 digits and display it around 0 to 9.
2. Requirement
- Arduino
- USB Cable
- 7 Segment 1 Digit (Cathode Type)
- Resistor 220 or 330 Ohm
- Electronic Wire
3. Building
The first build circuit like below on Figure 1.Figure 1: 7 Segment 1 Digit Connection |
4. Coding
// 22 October 2017
int PIN_A = 1;
int PIN_B = 2;
int PIN_C = 3;
int PIN_D = 4;
int PIN_E = 5;
int PIN_F = 6;
int PIN_G = 7;
int i = 0;
int j = 0;
int Arduino_Pins[7] = {PIN_A, PIN_B, PIN_C, PIN_D, PIN_E, PIN_F, PIN_G}; // an array of pin numbers to which LEDs
int Segment_Pins[10][7] = {{0,1,1,1,1,1,1}, // 0
{0,0,0,0,1,1,0}, // 1
{1,0,1,1,0,1,1}, // 2
{1,0,0,1,1,1,1}, // 3
{1,1,0,0,1,1,0}, // 4
{1,1,0,1,1,0,1}, // 5
{1,1,1,1,1,0,1}, // 6
{0,0,0,0,1,1,1}, // 7
{1,1,1,1,1,1,1}, // 8
{1,1,0,1,1,1,1}, // 9
};
void setup() {
// Configure Digital I/O
pinMode(PIN_A, OUTPUT);
pinMode(PIN_B, OUTPUT);
pinMode(PIN_C, OUTPUT);
pinMode(PIN_D, OUTPUT);
pinMode(PIN_E, OUTPUT);
pinMode(PIN_F, OUTPUT);
pinMode(PIN_G, OUTPUT);
}
void loop() {
for(i=0;i<10;i++)
{
for(j=0;j<7;j++)
{
digitalWrite(Arduino_Pins[j],Segment_Pins[i][j]);
}
delay(500);
if(i==9)
{
i = 0;
}
}
}
5. Result
Now we get a result, 7 Segment can display number from 0 to 9 with counting up.Royal University of Phnom Penh
Faculty of Engineering
Dep. Telecommunication and Electronic Engineering
Group Member:
1. Tann Thona
2. Thach Soveasna
3. Chhoy Noreath
4. Neth Channa
5. Mok Vira
Instructor: Prof. Chann Tola
Date: 22 October 2017
No comments:
Post a Comment