Float I2c

chucktodd:
Now for one more complication. You do realize that an arduino can be both a Master and a Slave at the same time?

just add the onRequest, onReceive events to the Master Sketch, change the Wire.begin() in the Master to Wire.begin(thirdslaveaddress);add the Wire.onReceive(),onRequest(). One more thing, put the volatile prefix on fnum, and foo. They will now be access in a ISR.

Now one proviso, The master CANNOT talk to itself successfully. if you put this new sketch into multiple Arduino's you could have them access each other.

If you added this complexity you would need to start monitoring the results from endTransmission(), requestFrom(). your transfers might get aborted if the transaction looses arbitration. you could no longer assume the master will always suceed.

multiple Master can be on the bus at the same time. Two masters can talk to the same slave at the same time. The master that wins is the one that transfers a byte with a low bit first.

Here is a good reference on the I2C buss Philips Electronics I2C Specs

Chuck.

I did think about that but not was 100% sure about it, Now you got me worried and think may have bit of more than I can chew but the main ting is I'm having fun it seems to be working ok here a sample of the data coming in

SLAVE ONE
foo=12.37
fnum=24
**************
SLAVE TWO
foo=12.36
fnum=50
**************
SLAVE ONE
foo=12.37
fnum=24
**************
SLAVE TWO
foo=12.36
fnum=50
**************
SLAVE ONE
foo=12.37
fnum=24
**************
SLAVE TWO
foo=12.36
fnum=50
**************
SLAVE ONE
foo=12.37
fnum=24
**************
SLAVE TWO
foo=12.36
fnum=50
**************

Thanks for the link it will be interesting bedtime reading :slight_smile:

EDIT... I got it counting set foo to read 12.36 then in the loop I added foo = foo + 0.01;