Hi all,
I'm trying to get two arduinos to communicate over i2c. I have it basically working, with the two transferring data both ways. However, when I first plug in the pair, they will not communicate until I reset the slave.
I connected the 5V, Gnd, A4, and A5 pins of an uno r2 and an uno r1 together and attached a 9v battery to one of them (pictures attached). On the "master", I put this sketch
The light on the master does not flash until I reset the slave by hitting the reset button; then it flashes. Resetting the master does nothing.
It seems to me the most likely culprit is a bug in the Wire libraries, since this sketch and the wiring is extremely simple and I've duplicated the results on several different wiring setups and sketches. I'm using a freshly-downloaded 1.0.3 IDE
Wire.requestFrom waits until it has a response (or a NAK) and the length of that response is returned from Wire.requestFrom. So, you may as well test that.
I can't reproduce your results.
Connecting two Unos, if I reset the Master, a moment later the LED flashes, indicating it read from the Slave.
If I reset the Slave, nothing happens (because the Master has already entered loop), unless I hold the Slave in reset, reset the Master, and then release the Slave from reset.
SoftSerial has quite a few limitations because it is bit banged. It's fine if you need to print something on an attached printer, while checking for RFID cards (as I do). But if you need to do a number of things at once, then its limitations become more apparent. They may or may not matter in a particular application.
Both SPI and I2C use the hardware features to output quite fast, and receive incoming data using interrupts (I know SoftSerial uses interrupts too, but once it starts a byte it has to sit in a tight loop).
Your comment about "softserial" ... "over uart" doesn't make much sense on its own, because SoftSerial doesn't use the UART.
With a larger chip like the Mega you could indeed use multiple hardware serial ports, if your application required it.