For the project, we want to have two Arduinos communicate with each other via wires. After some research I figured this was done by connecting SDA and SCL pins. However, one of the Arduinos is also connected to an OLED display wich uses the same pins. There is only one of each on the Nano. My question is, is it possible to connect different components to the same pin? Or will this mess up the program?
Connecting them in that way is possible, using the I2C bus (SDA/SCL). Also it is no problem if multiple I2C devices are connected to the same pins. We use that in assignment 6 for instance for the OLED display and the sensor. I guess you may have found a tutorial like this one for this.
Another approach which is possible also is to connect via the pins 0 and 1 (TX/RX), using standard serial-communication.