ARDUINO SEVENSEGMENT DISPLAY INTERFACING
PROGRAM (COMMON ANODE DISPLAY)
int num1=0;int digit1=0;
int counter=0;
void setup()
{
DDRD=0xff;
}
void loop()
{
if(counter>9)
{
counter=0;
}
num1=counter;
counter=counter+1;
if(num1==0)
{
PORTD=0b11000000;
}
if(num1==1)
{
PORTD=0b1111001;
}
if(num1==2)
{
PORTD=0b0100100;
}
if(num1==3)
{
PORTD=0b0110000;
}
if(num1==4)
{
PORTD=0b0011001;
}
if(num1==5)
{
PORTD=0b0010010;
}
if(num1==6)
{
PORTD=0b0000010;
}
if(num1==7)
{
PORTD=0b1111000;
}
if(num1==8)
{
PORTD=0b0000000;
}
if(num1==9)
{
PORTD=0b0010000;
}
delay(2000);
}
Comments
Post a Comment