Two wire Interface

I have tried interfacing two arduino and a color sensor using I2C. The problem is that before intergrating my color sensor everything was working fine. When i connect the color sensor(using TWI) in the arduino without the other arduino everything is working fine. The question is can one connect two line for two different device in the same pin in this case pin 4 and 5 analog.

No. Of pins 4 & 5, when using the TWI, one is sending out a clock
signal (stream of pulses) and the other is sending out a data stream.
I2C has a master/slave relationship and there's only one master, the
chip that generates the clock signal. Connecting two clocks, or two
output pins together, is a no-no -- both will "fight" to pull the clock
line high or low. If one output is high and the other is low then a short
circuit will occur and may damage both chips!

If both Arduino's need to access the color sensor then one Arduino
should interface to the sensor and use, say, either the hardware
serial port or a software serial port (via SoftwareSerial) to
communicate the sensor data to the other Arduino.

It depends on your configuration. In general, yes it is possible.

I don't know if the arduino Wire software supports an I2C multi-master configuration; if not, you can only have one master on the bus.

If you have one arduino as a slave, the other as a master, and the sensor as a slave, it should work. Check common ground, proper pull-up resistors, accidental shorts, etc.

-j

Hi,
Guys thanx for you time and info'.
I managed to figure my way out jargon :). I have connected both the slave arduino and the color sensor to my master arduino. And since the color sensor signal was to be used by the slave to perform its tasks, each time its through with one task and want the color sensor signal for the next task, it sends a signal to the master. The master reads from the sensor and transmits the color sensor signal.
I think once the sensor is on the slave, slave generates a clock signal which conflict with clock signal generated master arduino :-/. Its a serious mess since it caused the arduino to actually hang out. Once the slave began setting sensor register, both arduino hunged and nothing till i reset them.