# Problem sending a char array of lenght greater than 32 via I2C between 2 Arduino

**URL:** <https://forum.arduino.cc/t/problem-sending-a-char-array-of-lenght-greater-than-32-via-i2c-between-2-arduino/685740>\
**Category:** Networking, Protocols, and Devices\
**Created:** [December 5, 2020, 10:45am UTC](https://forum.arduino.cc/t/problem-sending-a-char-array-of-lenght-greater-than-32-via-i2c-between-2-arduino/685740 "2020-12-05T10:45:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hunt27](https://avatars.discourse-cdn.com/v4/letter/h/b487fb/32.png) [@hunt27](https://forum.arduino.cc/u/hunt27)\
**Post date:** [December 5, 2020, 10:45am UTC](https://forum.arduino.cc/t/problem-sending-a-char-array-of-lenght-greater-than-32-via-i2c-between-2-arduino/685740/1 "2020-12-05T10:45:04Z")

</div>

Good morning,

I noted that if I try to send a char array via I2C from an Arduino sender to an Arduino receiver, if this array exceeds 32 elements it won't be correctly read by the reciver.  
More specifically, I won't see any data, just "?????" on the serial monitor.  
If the lenght of this char array is less or equal than 32 it works fine.  
Do you know why I have this issue and if it can be overcomed?

Many thanks.

---

<div class="post-metadata">

**Author:** ![hunt27](https://avatars.discourse-cdn.com/v4/letter/h/b487fb/32.png) [@hunt27](https://forum.arduino.cc/u/hunt27)\
**Post date:** [December 5, 2020, 10:54am UTC](https://forum.arduino.cc/t/problem-sending-a-char-array-of-lenght-greater-than-32-via-i2c-between-2-arduino/685740/2 "2020-12-05T10:54:53Z")

</div>

This is the code i wrote

```cpp
void requestEvent() 
{ 
 myFile = SD.open("test.txt");
  if (myFile) 
  {
    Serial.println("test.txt:");
    int i=0;
    while (myFile.available()) 
    {
      dati[i] = myFile.read();
      i++;
    }

    myFile.close();
    
    Serial.println(sizeof(dati));
      
    Wire.write(dati, 33);//sizeof(dati));
  } 
  else 
  {
    Serial.println("error opening test.txt");
  }
  
}

```

This is the array i am talking about

```cpp
    Wire.write(dati, 33);//sizeof(dati));

```

---

<div class="post-metadata">

**Author:** ![Robin2](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/robin2/32/216045_2.png) [@Robin2](https://forum.arduino.cc/u/Robin2)\
**Post date:** [December 5, 2020, 10:58am UTC](https://forum.arduino.cc/t/problem-sending-a-char-array-of-lenght-greater-than-32-via-i2c-between-2-arduino/685740/3 "2020-12-05T10:58:11Z")

</div>

Send the text into chunks that don't exceed 32 bytes and reassemble it at the receiving end.

...R

---

<div class="post-metadata">

**Author:** ![Erik\_Baas](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/erik_baas/32/1098646_2.png) [@Erik\_Baas](https://forum.arduino.cc/u/Erik_Baas)\
**Post date:** [December 5, 2020, 11:17am UTC](https://forum.arduino.cc/t/problem-sending-a-char-array-of-lenght-greater-than-32-via-i2c-between-2-arduino/685740/4 "2020-12-05T11:17:27Z")

</div>

IIRC _Wire.h_ has a buffer size of 32 bytes.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 11:22am UTC](https://forum.arduino.cc/t/problem-sending-a-char-array-of-lenght-greater-than-32-via-i2c-between-2-arduino/685740/5 "2021-05-06T11:22:34Z")

</div>

Closed on May 6, 2021, 11:22am UTC


