Perhaps I misunderstand how to declare a union, I appreciate any help you can give, thank you!
My example was an anonymous union. If you use your declaration you have to use output.intval or output.bytes to access the union representations.
The trick of a union (http://en.wikipedia.org/wiki/Union_type
) is to have multiple ways to access the same memory area. This way you can set the output by bytes and use the integer interpretation afterwards:
b = firstbyte;
b = secondbyte;
uint16_t result = intval;
I have changed all of the relevant integers in the slave to be int16_t as suggested.
I did not only suggest to change the types but also to only submit the necessary two bytes. Your still sending 4 bytes, don't you?
Why are you calling requestEvent in loop()? You already declared it as the interrupt handler if an I2C request is received from the master.