LED matrix control (vertical and horizontal)

Hello everyone, thank you for you time to. I have some issue with my LEDs output I use 74154 to leds matrix y-axis and 74138 to leds matrix x-axis and 7404 inversor. I connect the leds with IDE cable which 5-horizontal and 5-vertical. My master arduino successful make connection with my slave.But I send ax01y01(I use this char to indicate row and column) to my slave but it read ax01y0. Missing the char 3. Futhermore the LEDs is not light. I hope someone can help me. Your help will be helpful to me. I attach my master, slave coding and my diargram :slight_smile:

Master code:

// Master Code
#include <Wire.h>
byte nChar =0;
char input[7];

void setup () {

  Serial.begin(9600);
  Wire.begin();
}

void loop()
{
  if (nChar < 7) {if (Serial.available()) { input[nChar++] = Serial.read();}}

    else {

      Wire.beginTransmission(1);

      //a
      Wire.write(input[0]);
      Serial.print("Drawer : ");
      Serial.println(input[0]);

      //x
      Wire.write(input[1]);
      Serial.print("Output : ");
      Serial.println(input[1]);

      //00
      Wire.write(input[2]);
      Wire.write(input[3]);
      Serial.print("Output : ");
      Serial.print(input[2]);
      Serial.println(input[3]);

      //y
      Wire.write(input[4]);
      Serial.print("Output : ");
      Serial.println(input[4]);

      //00
      Wire.write(input[5]);
      Wire.write(input[6]);
      Serial.print("Output : ");
      Serial.print(input[5]);
      Serial.println(input[6]);

      delay(15);

      while (Serial.available())
      {
        //Remove extra
        Serial.read();
      }
      Wire.endTransmission();
        nChar = 0;
        }
        }

Slave Code:

#include <Wire.h>
int ledPins[] = {7, 6, 5, 4, 3, 2,};
int ledPins2[] = {7, 6, 5, 4, 3, 2};
byte count;
byte nChar;
char c;
char input[8];
char data[50] = "";
int n;
#define nBits sizeof(ledPins)/sizeof(ledPins[0])
#define nBits sizeof(ledPins2)/sizeof(ledPins[0])



void setup()
{
  Wire.begin(1);
  Wire.onReceive(receiveEvent);
  Serial.begin(9600);
  for (byte i = 0; i < nBits; i++) {
    pinMode(ledPins[i], OUTPUT);
  }
for (byte i = 0; i < nBits; i++) {
    pinMode(ledPins2[i], OUTPUT);
    }
  Serial.begin(9600);
}

void loop()
{
  if (nChar < 8) {                    //accumulate three characters
    if (Serial.available()) {
      c = Serial.read();
      input[nChar++] = c;
    }
  }
  else {
    input[8] = 0;                   //atoi() expects string terminator
    n = atoi(input);                //convert the input characters to integer
    dispBinary(n);
    delay(100);                     //wait for any additional characters
    while (Serial.available()) {    //ignore them
      c = Serial.read();
    }
    nChar = 0;
  }
}



void receiveEvent(int howMany)
{
  while (1 < Wire.available()) {
    char c = Wire.read();
    Serial.print(c);
  }

}
void dispBinary(int n) //Vertical
{
  if (n >= 0 && n <= 6) {
    for (byte i = 0; i < nBits; i++) {
      digitalWrite (ledPins[i], n & 1);
      n /= 2;
    }
  }
}

void dispBinary2(int n) //Horizontal
{
  if (n >= 0 && n <= 6) {
    for (byte i = 0; i < nBits; i++) {
      digitalWrite (ledPins2[i], n & 1);
      n /= 2;
    }
  }

}

void b()
{
  if (data[0] != 'a')
  {
    dispBinary(atoi("00"));
    delay(100);
    dispBinary2(atoi("00"));
    delay(100);
    goto fin;
  }
  if (data[1] = 'x')
  {
    char xdata[2] = {data[2], data[3]};//(data[2], data[3]);
    dispBinary2(atoi(xdata));
    delay(100);
  }
  if (data[4] = 'y')
  {
    char ydata[2] = {data[5], data[6]};//(data[5], data[6]);
    dispBinary(atoi(ydata));
    delay(100);
  }
fin:;
}

I am having a hard time understanding what the slave code does. There appears to be a lot of junk in there which is not actually used.
For example these two arrays

int ledPins[] = {7, 6, 5, 4, 3, 2,};
int ledPins2[] = {7, 6, 5, 4, 3, 2};

Don't seem to be used and why two arrays with the same numbers in them. The pin number to which they referrer to are not even on your schematic.

The array char data[50], is it supposed to hold the data for the display? A 6 by 10 array needs 60 bytes assuming one byte per LED. And why does it seem to include received characters in it?
You don't seem to have any connection between what you receive on the I2C lines and your display. I also can't see anywhere in the code where you multiplex the data so I would not expect to see anything.

Finally I can't see any reference to the pins you show connected to your matrix in the code.

So sorry I can't make head nor tale of this code.

DON’T CROSS POST!!!

and the “Futhermore the LEDs is not light.” sounds like a cross post of this:

I HAVE REPORTED THIS THREAD TO THE MODERATORS

Duplicate posts waste the time of the people helping you. I might spend 15 minutes writing a detailed answer on this thread, without knowing that someone already did the same in the other thread. This behavior is very disrespectful to the people you’re asking for assistance. Just because we give our time freely doesn’t mean it has no value.

In the future, take some time to pick the forum section that best suits the topic of your question and then only post once to that forum section. This is basic forum etiquette, which you would already know if you had bothered reading the sticky “How to use this forum - please read.” post you will find at the top of every forum section. It contains a lot of other useful information. Please read it.