user13535: Can anyone help me regarding the output of this program? 
What is the function of Num_Write? 
Here is the code below:
int num_array[10][7] = { { 1,1,1,1,1,1,0 }, // 0 
{ 0,1,1,0,0,0,0 }, // 1 
{ 1,1,0,1,1,0,1 }, // 2 
{ 1,1,1,1,0,0,1 }, // 3 
{ 0,1,1,0,0,1,1 }, // 4 
{ 1,0,1,1,0,1,1 }, // 5 
{ 1,0,1,1,1,1,1 }, // 6
{ 1,1,1,0,0,0,0 }, // 7 
{ 1,1,1,1,1,1,1 }, // 8 
{ 1,1,1,0,0,1,1 }}; // 9 

void Num_Write(int); 

void setup() {  
  pinMode(2, OUTPUT); 
  pinMode(3, OUTPUT); 
  pinMode(4, OUTPUT); 
  pinMode(5, OUTPUT); 
  pinMode(6, OUTPUT); 
  pinMode(7, OUTPUT); 
  pinMode(8, OUTPUT); 
} 

void loop() {  
  for (int counter = 10; counter > 0; --counter) { 
    delay(1000); 
    Num_Write(counter-1); 
  } 
  delay(3000); 
} 

void Num_Write(int number) { 
  int pin= 2; 
  for (int j=0; j < 7; j++) { 
    digitalWrite(pin, num_array[number][j]); 
    pin++; 
  } 
}


user8033: Num_Write will map the output pins to display a number on the 7-segment display.
Please note that the schematic below is not the best, nor the proper way to connect a 7 segment display. It's intended to show the connection for illustrating purposes, not for actual wiring. Each segment lead should have it's own resistor. Also, depending on if you have a Common Anode or Common Cathode 7 segment, wiring will differ. 

When the number 0 is being displayed (check in the num_array) all segments are lit, except for the last segment (segment G).
void Num_Write(int number) {                 //Write a number to the 7-segment display. 
  int pin= 2;                                //Take the starting (output) pin.
  for (int j=0; j < 7; j++) {                //Loop through all the segments of the given number.
    digitalWrite(pin, num_array[number][j]); //Write the output pin according to the pattern in the "num_array" for the given number.
    pin++;                                   //Go to the next pin.
  } 
}

So by looping through the pins, and looping through the array (while setting the pins) we can display a number on the 7 segment display.
Extra:
The output will be somewhat like this, but then reversed (9 to 0) and withouth the A, B, C, D, E and F.


13535: <p>Can anyone help me regarding the output of this program? </p>

<p>What is the function of <code>Num_Write</code>? </p>

<p>Here is the code below:</p>

<pre><code>int num_array[10][7] = { { 1,1,1,1,1,1,0 }, // 0 
{ 0,1,1,0,0,0,0 }, // 1 
{ 1,1,0,1,1,0,1 }, // 2 
{ 1,1,1,1,0,0,1 }, // 3 
{ 0,1,1,0,0,1,1 }, // 4 
{ 1,0,1,1,0,1,1 }, // 5 
{ 1,0,1,1,1,1,1 }, // 6
{ 1,1,1,0,0,0,0 }, // 7 
{ 1,1,1,1,1,1,1 }, // 8 
{ 1,1,1,0,0,1,1 }}; // 9 

void Num_Write(int); 

void setup() {  
  pinMode(2, OUTPUT); 
  pinMode(3, OUTPUT); 
  pinMode(4, OUTPUT); 
  pinMode(5, OUTPUT); 
  pinMode(6, OUTPUT); 
  pinMode(7, OUTPUT); 
  pinMode(8, OUTPUT); 
} 

void loop() {  
  for (int counter = 10; counter &gt; 0; --counter) { 
    delay(1000); 
    Num_Write(counter-1); 
  } 
  delay(3000); 
} 

void Num_Write(int number) { 
  int pin= 2; 
  for (int j=0; j &lt; 7; j++) { 
    digitalWrite(pin, num_array[number][j]); 
    pin++; 
  } 
}
</code></pre>
 8033: <p>Num_Write will map the output pins to display a number on the 7-segment display.</p>

<p><em>Please note that the schematic below is not the best, nor the proper way to connect a 7 segment display. It's intended to show the connection for illustrating purposes, not for actual wiring. Each segment lead should have it's own resistor. Also, depending on if you have a Common Anode or Common Cathode 7 segment, wiring will differ.</em> </p>

<p><a href="https://i.stack.imgur.com/ku5o8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ku5o8.jpg" alt="Image of a 7segment connected to a microcontroller"></a></p>

<p>When the number 0 is being displayed (check in the num_array) all segments are lit, except for the last segment (segment G).</p>

<pre><code>void Num_Write(int number) {                 //Write a number to the 7-segment display. 
  int pin= 2;                                //Take the starting (output) pin.
  for (int j=0; j &lt; 7; j++) {                //Loop through all the segments of the given number.
    digitalWrite(pin, num_array[number][j]); //Write the output pin according to the pattern in the "num_array" for the given number.
    pin++;                                   //Go to the next pin.
  } 
}
</code></pre>

<p>So by looping through the pins, and looping through the array (while setting the pins) we can display a number on the 7 segment display.</p>

<p>Extra:
The output will be somewhat like this, but then reversed (9 to 0) and withouth the A, B, C, D, E and F.</p>

<p><a href="https://i.stack.imgur.com/Ivz0x.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ivz0x.gif" alt="seven segment counting up"></a></p>
