int NumbersInDecimal[] = {
63, 6, 91,
79, 102, 109,
125, 7, 127, 111
};
void setup()
{
DDRD |= 0x7F;
DDRB |= 0x30;
}
void loop()
{
// Count From 0
Counter();
// Display The 12 Number
// PORTB = 0b00100000;
// PORTD = NumbersInDecimal[1];
// delay(90);
// PORTB = 0b00010000;
// PORTD = NumbersInDecimal[2];
// delay(90);
}
void Counter()
{
// Count in the Units 7-Segment Only From 0 into 9
PORTB = 0b00010000;
for (int i = 0; i <= 9; i++)
{
PORTB = 0b00010000;
PORTD = NumbersInDecimal[i];
delay(200);
}
for (int j = 1; j <= 9; j++)
{
for (int i = 0; i <= 9; i++)
{
PORTB = 0b00100000;
PORTD = NumbersInDecimal[j];
delay(200);
PORTB = 0b00010000;
PORTD = NumbersInDecimal[i];
delay(200);
PORTB = 0b00100000;
}
}
for (int j = 9; j >= 1; j--)
{
for (int i = 9; i >= 0; i--)
{
PORTB = 0b00100000;
PORTD = NumbersInDecimal[j];
delay(200);
PORTB = 0b00010000;
PORTD = NumbersInDecimal[i];
delay(200);
PORTB = 0b00100000;
}
}
// Count in the Units 7-Segment Only From 9 into 0
PORTB = 0b00010000;
for (int i = 9; i >= 0; i--)
{
PORTD = NumbersInDecimal[i];
delay(200);
}
}