Using 2D array as parameter giving unexpected results

I'm using two 8x8 flexible LED grids, and attempting to control the two individually (each on their own data pin).

I'm attempting to make it light up in various different patterns/animations using multidimensional arrays.

However, when passing a 2D array as a parameter in a function, it seems to lose most of it's data. I saw in another thread that sizeof will not return the correct size because it's a pointer of the array. That's fine, I can pass the size as an additional parameter. The problem is the lack of the actual data.
For example, this is one of the arrays:

byte ROLLING_EYE[][64] = {
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
};

And then this is the code I'm currently using to read the array (no functionality because data isn't right)

void loop() {
  if (random(1, 100) >= 80) {
    rollEye(ROLLING_EYE, false);
  }
}
void rollEye(byte data[][64], bool isRightEye) {
  for(int i = 0; i < sizeof(data)-1;i++) {
    Serial.print(F("Idx: "));
    Serial.println(i);
    for(int j = 0; j < sizeof(data[i]) - 1; j++) {
    Serial.print(F("Idx2: "));
    Serial.print(j);
    Serial.print(F(" Val: "));
    Serial.println(data[i][j]);
    }
  }
}

And this is what appears in the Serial Monitor:

Idx: 0
Idx2: 0 Val: 1
Idx2: 1 Val: 1
Idx2: 2 Val: 1
Idx2: 3 Val: 1
Idx2: 4 Val: 1
Idx2: 5 Val: 1
Idx2: 6 Val: 1
Idx2: 7 Val: 1
Idx2: 8 Val: 1
Idx2: 9 Val: 1
Idx2: 10 Val: 1
Idx2: 11 Val: 1
Idx2: 12 Val: 1
Idx2: 13 Val: 1
Idx2: 14 Val: 1
Idx2: 15 Val: 1
Idx2: 16 Val: 1
Idx2: 17 Val: 1
Idx2: 18 Val: 0
Idx2: 19 Val: 0
Idx2: 20 Val: 1
Idx2: 21 Val: 1
Idx2: 22 Val: 1
Idx2: 23 Val: 1
Idx2: 24 Val: 1
Idx2: 25 Val: 1
Idx2: 26 Val: 1
Idx2: 27 Val: 1
Idx2: 28 Val: 0
Idx2: 29 Val: 0
Idx2: 30 Val: 1
Idx2: 31 Val: 1
Idx2: 32 Val: 1
Idx2: 33 Val: 1
Idx2: 34 Val: 0
Idx2: 35 Val: 0
Idx2: 36 Val: 0
Idx2: 37 Val: 0
Idx2: 38 Val: 1
Idx2: 39 Val: 1
Idx2: 40 Val: 1
Idx2: 41 Val: 1
Idx2: 42 Val: 0
Idx2: 43 Val: 0
Idx2: 44 Val: 0
Idx2: 45 Val: 0
Idx2: 46 Val: 1
Idx2: 47 Val: 1
Idx2: 48 Val: 1
Idx2: 49 Val: 1
Idx2: 50 Val: 1
Idx2: 51 Val: 1
Idx2: 52 Val: 1
Idx2: 53 Val: 1
Idx2: 54 Val: 1
Idx2: 55 Val: 1
Idx2: 56 Val: 1
Idx2: 57 Val: 1
Idx2: 58 Val: 1
Idx2: 59 Val: 1
Idx2: 60 Val: 1
Idx2: 61 Val: 1
Idx2: 62 Val: 1

(and then it repeats each loop) As you can see, it's missing a lot of values that should exist.

Ideally, I want a single function that I can pass [array] of values to and then have that function control the lights on whichever 8x8 LED grid is selected. I'm also trying to work within the Arduino Uno's limitations. Any tips regarding how to keep it at a manageable project size while being able to add a variety of different animations would be greatly appreciated.

try

byte ROLLING_EYE[][64] = {
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
};

const size_t nbCols = sizeof ROLLING_EYE[0] / sizeof * ROLLING_EYE[0];
const size_t nbRows = sizeof ROLLING_EYE / sizeof * ROLLING_EYE;

void print2DArray(const byte arr[], const size_t numRows, const size_t numCols) {
  for (size_t row = 0; row < numRows; row++) {
    for (size_t col = 0; col < numCols; col++) {
      Serial.print(arr[row * numCols + col]);
    }
    Serial.println();
  }
}



void setup() {
  Serial.begin(115200);
  print2DArray(*ROLLING_EYE, nbRows, nbCols);
}

void loop() {}

you would save a lot of memory (8x smaller) by using bits for each 0 and 1 and bitwise operation to access the individual bits

Post your complete code.

When passed to a function, array names decay to pointers. Thus, 'sizeof(data)' always evaluates to the fixed size of a pointer on the platform you're compiling for (typically 2 or 4 bytes).

Hello SimpleMindedMan

Consider:

byte ROLLING_EYEs[][64] = {
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
};
void setup()
{
  Serial.begin(115200);
  uint8_t index=0;
  for (auto &ROLLING_EYE : ROLLING_EYEs)
  {
    Serial.print("index "),Serial.print(index),Serial.print(" ");
    for (auto &EYE : ROLLING_EYE) Serial.print(EYE);
    index++;
    Serial.println("");
  }
}
void loop()
{
}

Have a nice day and enjoy coding in C++.

This helped a ton.

I see both you and @paulpaulson used 115200 instead of 9600 for Serial, is there any specific reason for this?

This is my current working code:

#include <Adafruit_NeoPixel.h>

#define PIN 3
#define PIN_TWO 6

#define NUMPIXELS 64

Adafruit_NeoPixel eyeOne = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel eyeTwo = Adafruit_NeoPixel(NUMPIXELS, PIN_TWO, NEO_GRB + NEO_KHZ800);

byte EYEBALL_STATIC[] = 
{
  1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 0, 0, 0, 0, 1, 1,
  1, 1, 0, 1, 1, 0, 1, 1,
  1, 1, 0, 1, 1, 0, 1, 1,
  1, 1, 0, 0, 0, 0, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1,
};

byte ROLLING_EYE[][64] = {
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
};

byte BLINKING_EYE[][64] = {
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
};

void setup() {
  eyeOne.begin();
  eyeTwo.begin();
  setEyeLights(EYEBALL_STATIC, 64, 1, false, 1000);
  setEyeLights(EYEBALL_STATIC, 64, 1, true, 1000);
}

const size_t rollCols = sizeof ROLLING_EYE[0] / sizeof * ROLLING_EYE[0];
const size_t rollRows = sizeof ROLLING_EYE / sizeof * ROLLING_EYE;
const size_t blinkCols = sizeof BLINKING_EYE[0] / sizeof * BLINKING_EYE[0];
const size_t blinkRows = sizeof BLINKING_EYE / sizeof * BLINKING_EYE;

void loop() {
  if (random(1, 100) >= 80) {
    setEyeLights(*ROLLING_EYE, rollRows, rollCols, false, 100);
    setEyeLights(EYEBALL_STATIC, 64, 1, false, 1000);
  }
  if (random(1, 100) >= 80) {
    setEyeLights(*ROLLING_EYE, rollRows, rollCols, true, 100);
    setEyeLights(EYEBALL_STATIC, 64, 1, true, 1000);
  }
  if (random(1, 200) >= 180) {
    setEyeLights(*BLINKING_EYE, blinkRows, blinkCols, false, 100);
    setEyeLights(EYEBALL_STATIC, 64, 1, false, 1000);
  }
  if (random(1, 200) >= 180) {
    setEyeLights(*BLINKING_EYE, blinkRows, blinkCols, true, 100);
    setEyeLights(EYEBALL_STATIC, 64, 1, true, 1000);
  }
}


void setEyeLights(const byte data[], const size_t numRows, const size_t numCols, bool isRightEye, int stageDelay) {
  bool rollBack = random(1, 4) >= 3;
  byte in = 0;

    for (size_t row = (rollBack ? numRows : 0); (rollBack ? row > 0 : row < numRows); (rollBack ? row-- : row++)) {
      for (size_t col = (rollBack ? numCols : 0); (rollBack ? col > 0 : col < numCols); (rollBack ? col-- : col++)) {
        if (data[rollBack ? (row * numCols - col): (row * numCols + col)] == 1) {
          (isRightEye ? eyeOne : eyeTwo).setPixelColor(in, (isRightEye ? eyeOne : eyeTwo).Color(50, 0, 0));
        }
        in++;
        if (in >= 64) {
          in = 0;
          (isRightEye ? eyeOne : eyeTwo).show();
          delay(stageDelay);
          (isRightEye ? eyeOne : eyeTwo).clear();
        }
      }
    }
}

I understand that it's not optimal, but it's what I was able to get to work. I tried to use the Adafruit_NeoPixel as a parameter in the setEyeLights function, but when doing so the lights simply wouldn't respond.

why would you want to go slow when your computer and the arduino can go faster... :slight_smile:

you would need to pass that by reference - which is denoted with the & after the type in the list of parameters. this way it's not a copy that is passed to the function but a reference to your real instance.

void setEyeLights(Adafruit_NeoPixel &eye, const byte data[], const size_t numRows, const size_t numCols, bool isRightEye, int stageDelay) {
 // now use eye in the function

and call just with the right eye param

setEyeLights(eyeOne, *ROLLING_EYE, rollRows, rollCols, false, 100);

or

setEyeLights(eyeTwo, *ROLLING_EYE, rollRows, rollCols, false, 100);

So why not set the baud rate even higher ?

Yes. It’s also an option, depends on what your code does and timing requirements / volume of printed data as you get an interrupt for each byte sent, so the faster you go, the closer the interrupts and possible disruption of the main code or another interrupt driven task

I standardised on using 115200 when I think that it was the highest supported baud rate, although I could be wrong. However, most (all ?) of the official Arduino examples, including those for later boards such as the Uno R4 still use the plodding 9600 baud rate which I find amusing and annoying in equal measure

There is, of course, a case for say that you should use the baud rate that is fast enough for your needs and mine are generally quite modest

If it’s for a human keyboard entry then fore sure 9600 won’t matter much.

If it’s for printing out stuff then as print becomes blocking when the outgoing buffer is full, you want a baud rate that is fast enough to empty the buffer as it fills in otherwise the baud rate becomes a throttling mechanism for your arduino.

I'll be honest. I genuinely thought the number was like a port number, not speed :sweat_smile:

This is the final working code until I can dig into using bits.

#include <Adafruit_NeoPixel.h>

#define PIN 3
#define PIN_TWO 6

#define NUMPIXELS 64

Adafruit_NeoPixel eyeOne = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel eyeTwo = Adafruit_NeoPixel(NUMPIXELS, PIN_TWO, NEO_GRB + NEO_KHZ800);

byte EYEBALL_STATIC[] = 
{
  1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 0, 0, 0, 0, 1, 1,
  1, 1, 0, 1, 1, 0, 1, 1,
  1, 1, 0, 1, 1, 0, 1, 1,
  1, 1, 0, 0, 0, 0, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1,
};

byte ROLLING_EYE[][64] = {
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 0, 0, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
};

byte BLINKING_EYE[][64] = {
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
  {
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
    1, 1, 0, 0, 0, 0, 1, 1,  // Forward
    1, 1, 0, 1, 1, 0, 1, 1,  // Reverse
    1, 1, 0, 1, 1, 0, 1, 1,  // Forward
    1, 1, 0, 0, 0, 0, 1, 1,  // Reverse
    1, 1, 1, 1, 1, 1, 1, 1,  // Forward
    1, 1, 1, 1, 1, 1, 1, 1,  // Reverse
  },
};

void setup() {
  eyeOne.begin();
  eyeTwo.begin();
  setEyeLights(EYEBALL_STATIC, 64, 1, eyeOne, 1000);
  setEyeLights(EYEBALL_STATIC, 64, 1, eyeTwo, 1000);
}

const size_t rollCols = sizeof ROLLING_EYE[0] / sizeof * ROLLING_EYE[0];
const size_t rollRows = sizeof ROLLING_EYE / sizeof * ROLLING_EYE;
const size_t blinkCols = sizeof BLINKING_EYE[0] / sizeof * BLINKING_EYE[0];
const size_t blinkRows = sizeof BLINKING_EYE / sizeof * BLINKING_EYE;

void loop() {
  byte rnd = random(1, 200);
  if (rnd >= 80 && rnd <= 100) {
    setEyeLights(eyeOne, *ROLLING_EYE, rollRows, rollCols, 100);
    setEyeLights(eyeOne, EYEBALL_STATIC, 64, 1, 1000);
  }
  if (rnd >= 101 && rnd <= 120) {
    setEyeLights(eyeTwo, *ROLLING_EYE, rollRows, rollCols, 100);
    setEyeLights(eyeTwo, EYEBALL_STATIC, 64, 1, 1000);
  }
  if (rnd >= 121 && rnd <= 140) {
    setEyeLights(eyeOne, *BLINKING_EYE, rollRows, rollCols, 100);
    setEyeLights(eyeOne, EYEBALL_STATIC, 64, 1, 1000);
  }
  if (rnd >= 141 && rnd <= 160) {
    setEyeLights(eyeTwo, *BLINKING_EYE, rollRows, rollCols, 100);
    setEyeLights(eyeTwo, EYEBALL_STATIC, 64, 1, 1000);
  }
}


void setEyeLights(Adafruit_NeoPixel &eye, const byte data[], const size_t numRows, const size_t numCols, int stageDelay) {
  bool rollBack = random(1, 4) >= 3;
  byte in = 0;

    for (size_t row = (rollBack ? numRows : 0); (rollBack ? row > 0 : row < numRows); (rollBack ? row-- : row++)) {
      for (size_t col = (rollBack ? numCols : 0); (rollBack ? col > 0 : col < numCols); (rollBack ? col-- : col++)) {
        if (data[rollBack ? (row * numCols - col): (row * numCols + col)] == 1) {
          eye.setPixelColor(in, eye.Color(50, 0, 0));
        }
        in++;
        if (in >= 64) {
          in = 0;
          eye.show();
          delay(stageDelay);
          eye.clear();
        }
      }
    }
}

I appreciate all the help <3

Glad you found a solution! Have fun

Hum that’s weird
You call setEyeLights with eyeOne as the 4th parameter

When the function expects it as the first

Make sure you modify the preferences and set the warning level when compiling to the highest level and address them as you see them printed during compile time.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.