i2c slave write to ARM powered device master
It is important to understand, that Wire.write() will not actually send data over the I2C bus. It will only put the data bytes into the send buffer of the library.

The normal way of the Wire library to send data as a slave is to implement the onRequest callback function. It will be called from an I2C ISR when a master on the I2C bus requests data from this slave. In the callback, you use Wire.write() to fill the buffer with data, which then get's send out to the master.

I'm not quite sure about the following: My guess regarding your previous code is, that the Wire library clears the send buffer at some time during the send or read code. That would mean, that the data written in the onReceive callback will simply be lost, instead of used for transmission of requested data. That might be meant that way, so that the users will stick to implementing the onRequest callback, which is the correct way of doing it.



Note: In your code, you call Wire.onReceive(receiveEvent) on every void loop() iteration. That isn't necessary. The Wire.onReceive() method only set's a function pointer to the callback function. It does NOT execute this callback function, which only will be called by the corresponding I2C ISR, when data is actually received. You should use this line only once in setup() to setup the callback function. Though using it multiple times does not break things here. It's just useless.