I want a Arduino Mega to communicate with a Arduino Leonardo by use of I2C. Both are connected by the USB cable to the same PC. My question is if this will connevt the ground planes of each Arduino to each other? Or is a separate wire between the GND pins on the two Arduinos still necessary?
If you disconnect one usb port, the Arduino board might get damaged with static electricity or something like that.
It is safer to connect both grounds, even if that creates a ground loop. Perhaps you can connect the Arduino grounds with 10 ohm resistor to reduce any ground loop current, but I don't think that is needed. Just connect both grounds.