I have a question for those who know about such things: is there any particular reason for the Wire (I2C) library to communicate on Analog pins 4 and 5? The signals in the protocol are all standard TTL-style digital signals, so why can't the library be modified to use some combination of the Arduino's digital pins? And if this was done, where in the library would it be done? I looked at Wire.cpp and my eyes began to fog over. I did a search for "4" and "5" (as well as their binary equivalents) and they didn't come up anywhere.
i2c is built into the atmega. the library is only an interface for the internal setup as far as i know. arduino pins 4 & 5 dedicated i2c pins on the micorcontroller
you're right that it should be possible to use i2c on other pins in general. though i believe the hardware function is buffered and communicates in the background while the main application can do something else. basically the same as serial RX/TX communication, for which there is a library to "emulate" the native function on other pins than 0 & 1 (i believe).
best, kuk
kuk has it right - the I2C hardware inside the ATmega is on those pins. To use other pins, you'd have to wite a "software I2C" library along the lines of the SoftwareSerial library, and similarly lose a lot of functionality.
-j
That's useful information I hadn't seen anywhere else. I had no idea the Atmega168 had I2C support built in (of course, I never noticed I2C until it was a feature I needed) - I assumed the Wire library was an all-software implementation. Ok, so I have to use the analog pins. As you probably have guessed, I'm using those analog pins. I guess I could replace those pins with an I2C analog-to-digital converter once I got I2C working. The problem with analog pins is you can't exactly multiplex them unless you use a bidirectional switch (which, of course, imposes its only analog effects which would have to be programmatically accounted for).
There are lots of ADC peripherals out there. I just put together a circuit with two 8 channel ADCs from Microchip - MPC3208, IIRC. They're SPI interfaced and 12 bit resolution to boot.
You can also use an analog mux (4051) and a few digital pins to multiplex the analog inputs to a single pin.
-j
The thing about the analog pins on the Arduino is that they are already internally multiplexed. The chip only actually has one ADC to which it multiplexes the various analog inputs. Using an external analog multiplexer with one analog pin and a few control pins to control which pin you're reading shouldn't result in different readings than directly reading the analog pins themselves.
As far as ADC chips, in addition to the one kg4wsv posted maxim has several chips in I2C and SPI interfaces. Their SPI goes as high as 16 bit and 32 channel.
http://para.maxim-ic.com/en/search.mvp?fam=dac&375=Serial%20-%20I2C&tree=daconverters