dynamic led matrix control, modifying array's data

I'm working on a project that required to dynamically modify an 8x8 ledmatrix display (produced by fried circuits). In the example arduino program we learn that the controller of the ledmatrix refer to an array of 8 8 bit binary number to set the led to ON/OFF.

This array (in this form) will, when called, lit every leds:

byte un[8] = {
B11111111,
B11111111,
B11111111,
B11111111,
B11111111,
B11111111,
B11111111,
B11111111};

I want dynamicaly modify that reference array with an external interface (program in MAX/MSP on a mac) that send control data though a wifi connection (using OSC protocol) to the arduino. This connection works well. My strategy for now is to send 8 integrer numbers (0-255), and read each bits of each of them, to produce 8 bits binaries that will replace the one stored in the array.

byte un[8] = {
B00000000,
B11111111,
B00000000,
B11111111,
B00000000,
B11111111,
B00000000,
B11111111,};

int j = 0;

void setup()
{
    Serial.begin(115200);
    WiFi.disconnect(true);
    WiFi.begin(ssid, pwd);
    WiFi.config(ip, gateway, subnet);
    
    while (WiFi.status() != WL_CONNECTED)
    {
        delay(500);
        Serial.print(".");
    }

    osc.begin(udp, recv_port);
    osc.addCallback("/ard", &transfert);
}

void loop()
{
    osc.parse();
}

void transfert(OSCMessage& m) */ receive  a message with 8 integers, let says 10 20 30 40 50 60 70 80
{
  for (int i=0;i<8;i++)  // loop through all the integrer received
{
     for (int j=7;j>=0;j--) // loop through all the 8 bit of each integer
   Serial.print(bitRead(m.getArgAsInt32(i),j)); // print them. all good
   Serial.println("");
 }

I get this in the serial monitor:

00001010
00010100
00011110
00101000
00110010
00111100
01000110
01010000

Now trying to read those and try to replace the array number with them doesn't work that good.

void transfert(OSCMessage& m) // receive with 8 integrer, let says 10 20 30 40 50 60 70 80
{
  for (int i=0;i<8;i++)  // loop through all the integrer received
{
     for (int j=7;j>=0;j--) // loop through all the 8 bit of each integrer
   Serial.print(bitRead(m.getArgAsInt32(i),j)); // print them. all good
   /* here I try to get each bit of each integrer received to replace the 8 bit value in the array "un"
   */
   trans1[j] = (bitRead(m.getArgAsInt32(i),j));
   bitWrite(un[i], j, trans1[j]); //
   Serial.println("");
 }
   Serial.println("----");
   Serial.print(un[0]);
   Serial.println("");
   Serial.print(un[1]);
   Serial.println("");
   Serial.print(un[2]);
   Serial.println("");
   Serial.print(un[3]);
   Serial.println("");
   Serial.print(un[4]);
   Serial.println("");
   Serial.print(un[5]);
   Serial.println("");
   Serial.print(un[6]);
   Serial.println("");
   Serial.print(un[7]);
   Serial.println("");
   Serial.println("<<<<<");
   delay(200);
}

I get this result in the serial monitor.

00001010
00010100
00011110
00101000
00110010
00111100
01000110
01010000

0
254
0
254
0
254
0

The bitRead and then bitWrite approach should be working but I certainly do something wrong (or more…)

Your input on this will be appreciate.

I might add that this is one approach I explored. One other promessing alternative would be to send a string to the arduino. Receive with a m.getArgAsString(i) instead of a m.getArgAsInt32(i). So I could receive a message on this form "B11111111" but as a string. I failed to find a solution to replace the data in the array for driving the less. The array is in bytes and there is a conversion problem…

Thanks

Why do you mess with bits? If you have received an int, just take the LSB and store it it your array...

un[i] = (byte) m.getArgAsInt32(i)

This array (in this form) will, when called, lit every leds:

You do NOT call arrays. You call functions.