Which as I am sure you can see is to control an 8 x 8 LED matrix with a Max 7219 progressively lighting the LED's from position (0, 0) to LED at position (7, 7) the top row of the matrix being LED (0, 0) TO LED (0,7) and then once all 64 LED's are on, turning them off one by one back to the starting position.

With regard to the first two for loops, in the void down () function, presumably in the first for loop, int row = 0; initialises the row counter variable as zero, then row < 8 ; is the test condition which is true, so the code moves to the second for loop and goes through the same procedure for the columns and if this test is also true then the code lc.setLed(0,row,col,true); is executed lighting the LED at position (0, 0) then implementing delay(timer);

What I am having trouble understanding is why the code for the columns, increments from column 0 to column 7, before the first for loop then does it's first increment from the initialised row 0 to row 1, prior to the second for loop again incrementing through columns 0 to 7.

I think I understand the basic sequence of events in one for loop but two nested like this is confusing me. Can anyone please take a few minutes to try and explain the sequence of decisions that this code executes.

What I am having trouble understanding is why the code for the columns, increments from column 0 to column 7, before the first for loop then does it's first increment from the initialised row 0 to row 1, prior to the second for loop again incrementing through columns 0 to 7.

I'm not sure I understand the question.You can only do one thing at a time, so scanning is this way seems, to me, perfectly natural.

When you read a page of text, you scan the words first across the line, then down the page.

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.Do not send technical questions via personal messaging - they will be ignored.

I realise that this is normal behaviour but what I am trying to ask is why the code "uses" row 0 then goes to the columns "for loop" lighting all LED's in the row 0 and then incrementing the row counter to row 1 and lighting all the LED's in row 1. Why does the code remain in the column "for loop" incrementing from col 0 to col 7 before going back to the row "for loop"

I don't mean to sound like a simpleton but if you read a page you go through it from start to finnish without going back and repeatably reading one particular passage. This is what is what I am not getting. Do not some sections of code execute what is "in the curly brackets"and then go back to the for loop that initiated them until that loop cannot logically execute what is "in the curly brackets" and then either go onto the next section of code in void loop or back to the start of void loop. Thanks for trying to help me with this I appreciate your time.

1. the row counter is initialised at zero 2. the column for loop initialises at col 0, then executes setLed progressively for all columns through to col 73. the code then goes back to the first for loop where the row counter is now set to row 14. the second for loop again executes setLed progressively for all columns through to col 7 but obviously now on row 15. this continues until row 7 goes through the same routine and then the code moves to void down

Would someone have a moment to explain to me why in this code there is a brief pause before the code resumes if I declare variable test in the for loop as an int, whereas if I declare it as a byte there is no pause. Just curious thanks.

So moving a "1" leftwards across, is shifting 16 bits to the left before the "1" comes back around, so to speak. But doesn't shifting a "1" to the right also also have to shift 16 bits to the right before comes back around (not doubting you obviously just trying to understand ) or does it have something to do with the difference between declaring the test variable as int or byte? Is maybe the byte declaration shifting a whole byte at a time whereas the bit declaration is shifting one bit at a time. Thanks CR.

It shifts left 16 bits - then it falls off the end, test becomes 0, the for:next loop ends,and loop can start over with test = 1.

There's only something displayed while test is 00000001, 00000010, 00000100, 00001000, 00010000, 00100000, 01000000, 10000000.While test is an int, there is no display while test is 000000010000000, out to 1000000000000000.

I tried to put char led = B10000001; and int mask = 1; at the top of the code prior to setup and the if else and mask code into loop which did compile but did not light LED's 1 and 6 as hoped. I realise that this is a roundabout way to light two LED's but as I said at the start I am doing this to learn how to code and feel that this is an important coding technique to understand and use. Thank you for taking the time to read this and hopefully explain what I am doing wrong,