/*int D1 = A3;
int D2 = A2;
int D3 = A1;
int D4 = A0;
/*int A=0;
int B=1;
int C=2;
int D=3;
int E=4;
int F=5;
int G=6;
int DP=7;
unsigned char binary_pattern[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
unsigned int a,b,c,d;
unsigned int counter = 0;
void setup()
{
pinMode(D1, OUTPUT);
pinMode(D2, OUTPUT);
pinMode(D3, OUTPUT);
pinMode(D4, OUTPUT);
DDRD = 0xff;
}
void loop()
{
digitalWrite(D1, HIGH);
digitalWrite(D2, HIGH);
digitalWrite(D3, HIGH);
digitalWrite(D4, HIGH);
while(1)
{
a = counter / 1000; // holds 1000's digit
b = ((counter/100)%10); // holds 100's digit
c = ((counter/10)%10); // holds 10th digit
d = (counter%10); // holds unit digit value
PORTD=binary_pattern[a]; // send 1000's place data to fourth digit
D1=0; // turn on forth display unit
delay(10000);
D1=1; // turn off forth display unit
PORTD=binary_pattern[b]; // send 100's place data to 3rd digit
D2=0; // turn on 3rd display unit
delay(1000);
D2=1; // turn off 3rd display unit
PORTD=binary_pattern[c]; // send 10th place data to 2nd digit
D3 = 0; // turn on 2nd display unit
delay(1000);
D3 = 1; // turn off 2nd display unit
PORTD=binary_pattern[d]; // send unit place data to 1st digit
D4 = 0; // turn on 1st display unit
delay(1000);
D4 = 1; // turn off 1st display unit
if(counter>=1000) //wait till flag reaches 100
{
counter=0; //only if flag is hundred "i" will be incremented
}
counter++; //increment flag for each flas
}
return ;
}*/
void setup() {
// initialize digital pin LED_BUILTIN as an output.
//pinMode(LED_BUILTIN, OUTPUT);
DDRD=0XFF;
}
// the loop function runs over and over again forever
void loop() {
/*digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000);*/
//while(1) //infinite loop
{
PORTD = 0xFF; //Turns ON All LEDs
delay(1000); //1 second delay
PORTD= 0x00; //Turns OFF All LEDs
delay(1000); //1 second delay
} // wait for a second
}