Sending a struct over i2c How would you send a struct from an i2c slave when requested by an i2c master?
Slave Struct Respdonder Sketch (Seeeduino Xiao)
#include &lt;Wire.h&gt;

struct TransmitData
{
  int a;
  int b;
  int c;
  int d;
  float e;
  float f;
  float g;
  float h;
};

TransmitData data;

void setup()
{
  Serial.begin(9600);
  Wire.begin(2);
  Wire.onRequest(requestEvent);

  data.a = 1;
  data.b = 2;
  data.c = 3;
  data.d = 4;
  data.e = 5.1;
  data.f = 6.1;
  data.g = 7.1;
  data.h = 8.1;
}

void loop()
{
  delay(100);
}

void requestEvent()
{
  Serial.print(&quot;sending (&quot;); Serial.print(sizeof data); Serial.println(&quot; bytes)&quot;);
  Wire.write((byte *)&amp;data, sizeof data);
}

Master Struct Requester/Reciever Sketch (Arduino MEGA)
#include &lt;Wire.h&gt;

struct TransmitData
{
  int32_t a;
  int32_t b;
  int32_t c;
  int32_t d;
  float e;
  float f;
  float g;
  float h;
};

TransmitData data;

void setup() {
  Wire.begin();
  Serial.begin(9600);
}

void loop() {
  Serial.print(&quot;requesting (&quot;); Serial.print(sizeof data); Serial.print(&quot; bytes)... &quot;);
  if (Wire.requestFrom(2, sizeof data)) {
    Wire.readBytes((byte*) &amp;data, sizeof data);
    Serial.println(&quot;done&quot;);

    Serial.println(data.a);
    Serial.println(data.b);
    Serial.println(data.c);
    Serial.println(data.d);
    Serial.println(data.e);
    Serial.println(data.f);
    Serial.println(data.g);
    Serial.println(data.h);
  } 
  else {
    Serial.println(&quot;could not connect&quot;);
  }
  delay(500);
}

The serial output on the slave device is:
sending (32 bytes)

The serial output on the master device is:
requesting (24 bytes)... done
1
0
2
0
0.00
0.00
5.10
6.10
int isn't guaranteed to be the same size across platforms. Use fixed width integer types instead.
https://en.cppreference.com/w/cpp/types/integer
struct TransmitData
{
  int32_t a;
  int32_t b;
  int32_t c;
  int32_t d;
  float e;
  float f;
  float g;
  float h;
};