That worked.
I added the following function to I2C_Anything.h
template <typename T> int I2C_singleWriteAnything (const T& value) {
int size = sizeof value;
byte vals[size];
const byte* p = (const byte*) &value;
unsigned int i;
for (i = 0; i < sizeof value; i++) {
vals[i] = *p++;
}
Wire.write(vals, size);
return i;
}
And it works perfectly, even in the onRequest handler.
Thanks 4.2 zillions!
Eric Rombokas