August 14
2009
A note to self->Wire.lib Is stupid!
The Wire.lib In Arduino is a stupid 7 bit interface! Not 8!
Lets say you want the arduino to be a I2C slave with Wire lib address 1
Wire.begin(1);
To access this with another I2C device:
- The write address would be (1<<1)
- The read address would be (1<<1)|1
In other words: A Wire address of 1 seems to result in write address of 2, and a read address of 3
So if you use the Arduino Code examples..
Wire.begin(2);
Write:
(2<<1)=4
0010 <<1 = 0100
Read:
(2<<1)|1= 5
0010<<1 =0100
0100 | 1 = 0101
so much annoyance!