Arduino code for interfacing 7 Segment Display to Arduino and displaying 0 to 9 digits on the 7 Segment display in a loop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//e = 2; | |
//d = 3; | |
//c = 4; | |
//g = 5; | |
//f = 6; | |
//a = 7; | |
//b = 8; | |
int num[10][7]={ {0,0,0,1,0,0,0}, | |
{1,1,0,1,1,1,0}, | |
{0,0,1,0,1,0,0}, | |
{1,0,0,0,1,0,0}, | |
{1,1,0,0,0,1,0}, | |
{1,0,0,0,0,0,1}, | |
{0,0,0,0,0,1,1}, | |
{1,1,0,1,1,0,0}, | |
{0,0,0,0,0,0,0}, | |
{1,0,0,0,0,0,0} | |
}; | |
void setup() | |
{ | |
pinMode(2,OUTPUT); | |
pinMode(3,OUTPUT); | |
pinMode(4,OUTPUT); | |
pinMode(5,OUTPUT); | |
pinMode(6,OUTPUT); | |
pinMode(7,OUTPUT); | |
pinMode(8,OUTPUT); | |
pinMode(9,OUTPUT); | |
digitalWrite(2,HIGH); | |
digitalWrite(3,HIGH); | |
digitalWrite(4,HIGH); | |
digitalWrite(5,HIGH); | |
digitalWrite(6,HIGH); | |
digitalWrite(7,HIGH); | |
digitalWrite(8,HIGH); | |
digitalWrite(9,HIGH); | |
} | |
void loop() | |
{ | |
for(int i=0;i<10;i++) | |
{ | |
for(int j=0;j<7;j++) | |
{ | |
digitalWrite(j+2,num[i][j]); | |
} | |
delay(1000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment