Shifting down LED's

Hey, I have a problem with my code. I need to make a side border that will shift down and create illusion as if it was moving (as in the picture)

That’s my code currently but it doesnt work as it’s supposed to. Can anyone give me some usefull tips or solutions ?

void createNewTopWallBlocks() {
 createNewBlock(0, 0, true);
 createNewBlock(0, 1, false);
  createNewBlock(7, 0, true);
 createNewBlock(7, 1, false);

void createNewBlock(int x, int y, bool border) {
  if (border)
    blocks[x][y] = 5;
    blocks[x][y] = 6;

void scrollAllBlocks() {
  for (int y = 5; y >= 0; y--) {
    for (int x = 0; x < 8; x++) {
      blocks[x][y+1] = blocks[x][y];


void renderBlocks() {
  // AberLED.clear() must have been called before
  for (int x = 0; x < 8; x++) { 
    for (int y = 0; y < 8; y++) {
      switch (blocks[x][y]) { 
        case 0:
        case 1: 
        case 5:
          AberLED.set(0, y, RED);
          AberLED.set(7, y, RED);
        case 6:                              
          AberLED.set(0, y, BLACK);
          AberLED.set(7, y, BLACK);
        default: // anything else must be yellow
          AberLED.set(x, y, YELLOW);
  // AberLED.swap() must be called later

That is not the entire code. Use comments, in the code, to tell what the lines of code are intended to do. Then attach the complete sketch.

Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

What model Arduino are you using?
What display are you using?
Can you post a link to spec/data?

Thanks.. Tom... :slight_smile:

Well, it's Arduino Uno R3 with custom University Game Matrix 8x8 Led. The problem is that I'm not allowed to use any other libraries. So basically the LED's need to be shifted down using only loops.

In scrollAllBlocks the y-index loops from 5. Is that good? It looks odd to me.
Maybe You should test the various functions one by one to verify proper action. Scrolling means blacking the old and lightin up the new one and handling the wrap around at the bottom. Algorithms like this consist of starting up, running and finishing, or being in sync for a restart.

What library are you using?
Can you post a link to its source?
Did the library come with examples?
Can you post your complete code?
Are you writing code that just does this scroll only, no other code added?
If not then write some code to just attempt to get the scroll to work.

Thanks.. Tom.. :slight_smile:

Or send us a crystal ball...… We need more info to take action.

Seems like you could just alternate a bit additiion and bit shift in a byte variable and input that into your blocks function. Since rows 0 and 7 seem to be duplicated, even easier.
Psudocode -
byte Edgebits = 0;
bool Edgestate = 0;
If Edgestate {
Edgestate ++;
Edgebits ++;
Else {
Edgestate ++;
Edgebits << ;

Think should fill up a byte with alternating 0s and 1s to use as input for your function.