WTFMoogle.com

A note to self->Wire.lib Is stupid!

by Moogle on Aug.14, 2009, under Arduino / AVR

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!


Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!