How to properly send elapsedMillis via Wire/I2C?

I have a project at my house that connects 2 Arduinos. I have the Master, which has a sensor attached to it, and it sends the sensor data to the slave. However, I wanted to also send the time , in milliseconds, that it takes to send a message via I2C. I managed to do it, but I can't send it via I2C.

If I try to send the elapsedMillis as int, I get -1 as the result. All other classes wont work.

What would be the proper way to do it?

Millisecons, or better, the return of the function millis() is unsigned long. How do you "change" the type of the variable to int? Maybe this is the only problem! Can you post your code?

why don’t you track when you start a read of data and when you complete it on the receiving arduino side, versus sending more data.

jasit

RockyTV:
I wanted to also send the time , in milliseconds, that it takes to send a message via I2C. I managed to do it, but I can't send it via I2C.

I can't make sense of this.

It sounds like you want to get the number of millisecs that it takes to send a message (what message?) and then send that number.

I have no idea what "[you] managed to do" ?

or what, exactly you can't send ?

...R