for (int i=7;i<14;i++)
{
pinMode(i, OUTPUT);// taking all pins from 7 - 13 as output
}
delay(1000);
}
void loop()
{
switch (DIGIT)
{
case 0:
//when count value is zero show”0” on disp
digitalWrite(segment_A, HIGH);
digitalWrite(segment_B, HIGH);
digitalWrite(segment_C, HIGH);
digitalWrite(segment_D, HIGH);
digitalWrite(segment_E, HIGH);
digitalWrite(segment_F, HIGH);
digitalWrite(segment_G, LOW);
break;
case 1:// when count value is 1 show”1” on disp
digitalWrite(segment_A, LOW);
digitalWrite(segment_B, HIGH);
digitalWrite(segment_C, HIGH);
digitalWrite(segment_D, LOW);
digitalWrite(segment_E, LOW);
digitalWrite(segment_F, LOW);
digitalWrite(segment_G, LOW);
break;
case 2:// when count value is 2 show”2” on disp
digitalWrite(segment_A, HIGH);
digitalWrite(segment_B, HIGH);
digitalWrite(segment_C, LOW);
digitalWrite(segment_D, HIGH);
digitalWrite(segment_E, HIGH);
digitalWrite(segment_F, LOW);
digitalWrite(segment_G, HIGH);
break;
case 3:// when count value is 3 show”3” on disp
digitalWrite(segment_A, HIGH);
digitalWrite(segment_B, HIGH);
digitalWrite(segment_C, HIGH);
digitalWrite(segment_D, HIGH);
digitalWrite(segment_E, LOW);
digitalWrite(segment_F, LOW);
digitalWrite(segment_G, HIGH);
break;
case 4:// when count value is 4 show”4” on disp
digitalWrite(segment_A, LOW);
digitalWrite(segment_B, HIGH);
digitalWrite(segment_C, HIGH);
digitalWrite(segment_D, LOW);
digitalWrite(segment_E, LOW);
digitalWrite(segment_F, HIGH);
digitalWrite(segment_G, HIGH);
break;
case 5:// when count value is 5 show”5” on disp
digitalWrite(segment_A, HIGH);
digitalWrite(segment_B, LOW);
digitalWrite(segment_C, HIGH);
digitalWrite(segment_D, HIGH);
digitalWrite(segment_E, LOW);
digitalWrite(segment_F, HIGH);
digitalWrite(segment_G, HIGH);
break;
case 6:// when count value is 6 show”6” on disp
digitalWrite(segment_A, HIGH);
digitalWrite(segment_B, LOW);
digitalWrite(segment_C, HIGH);
digitalWrite(segment_D, HIGH);
digitalWrite(segment_E, HIGH);
digitalWrite(segment_F, HIGH);
digitalWrite(segment_G, HIGH);
break;
case 7:// when count value is 7 show”7” on disp
digitalWrite(segment_A, HIGH);
digitalWrite(segment_B, HIGH);
digitalWrite(segment_C, HIGH);
digitalWrite(segment_D, LOW);
digitalWrite(segment_E, LOW);
digitalWrite(segment_F, LOW);
digitalWrite(segment_G, LOW);
break;
case 8:// when count value is 8 show”8” on disp
digitalWrite(segment_A, HIGH);
digitalWrite(segment_B, HIGH);
digitalWrite(segment_C, HIGH);
digitalWrite(segment_D,HIGH);
digitalWrite(segment_E, HIGH);
digitalWrite(segment_F, HIGH);
digitalWrite(segment_G, HIGH);
break;
case 9:// when count value is 9 show”9” on disp
digitalWrite(segment_A, HIGH);
digitalWrite(segment_B, HIGH);
digitalWrite(segment_C, HIGH);
digitalWrite(segment_D, HIGH);
digitalWrite(segment_E, LOW);
digitalWrite(segment_F, HIGH);
digitalWrite(segment_G, HIGH);
break;
break;
}
if (DIGIT<10)
{
DIGIT++;
delay(1000);///increment count integer for every second
}
if (DIGIT==10)
{
DIGIT=0;// if count integer value is equal to 10, reset it to zero.
delay(1000);
}
}
Next Post
0 Comments