About digitalWrite

Hello to everybody First of all I apologise for my bad english
I have a question about the use of digitalWrite
I have a matrix led and i work with this code (Which is work fine)

int delayTime= 80;        // 1mS increments before next LED
int delayStep;
int ledPin, col, row ;

void setup()               // run once, when the sketch starts
{
for (ledPin=2; ledPin <=12; ledPin++)   // Standard setup for LMP
{ pinMode(ledPin, OUTPUT);             // sets the digital pin as output
digitalWrite(ledPin,(ledPin <=7)) ;     // and sets all OFF
}
}

void loop()                                     // run over and over again
/* Map PORTB == D8:D13
   PORTD == D0:D7
   Our output: col::D7:D2
   (8-col) -ve (LOW)
   while row::D8:D13 +ve
   (row+7) +ve (HIGH)
*/
{
for (row=1; row <=5; row++) 
{                                            // Vertical: left to right
digitalWrite(row + 7,HIGH);    // Enable entire ROW
for (col=1; col <=6; col++) 
{                                           // then one pixel per col
digitalWrite(8- col,LOW);      // gets turned on
delay(delayTime);                 // for a moment
digitalWrite(8- col,HIGH);     // then OFF before next one
}                            
digitalWrite(row + 7, LOW);   // We're done with this row
}
.........................

I learn in arduino reference quide that the syntax of digitalWrite is digitalWrite (pin, value)
The value is possible to be HIGH or LOW
But in the above code the value is numeric (if understand well)

1st question : What value take the expression digitalWrite(ledPin,(ledPin <=7)
i suppose that take every cycle of "if" the value
1st cycle > digitalWrite(1, 1)
2nd cycle > digitalWrite(2, 2)
3nd cycle > digitalWrite(3, 3)
4th cycle > digitalWrite(4, 4)
5th cycle > digitalWrite(5, 5)
6th cycle > digitalWrite(6, 6)
7th cycle > digitalWrite(7, 7)
and after in 8th cycle what?

2nd queston : When the value is numeric the pin is HIGH or LOW?

The above code is from http://www.instructables.com/id/Build-a-low-cost-scrolling-LED-display-for-your-A/step6/A-test-sketch/

Thanks
babis

What value take the expression digitalWrite(ledPin,(ledPin <=7)

If ledPin <= 7 then the value written is HIGH, otherwise it is LOW.
The value of HIGH is 1, the value of LOW is 0 (zero)
So, if ledPin is 4
digitalWrite(4, 1);

Thank you for your reply :slight_smile: