Best way to make 2 arduinos communicate in my case...?

Hello,
I have a project going on that requires 2 arduinos.
Basicly 1st arduino will ajdust 1 digital potentiometer, 1 relay and I have some led movement going on with commands received from IR (remote).
2nd arduino will ajdust second digital potentiometer, 4 relays with commands received from bluetooth module.
I have rx and tx pins avalible plus 3 other digital pins.

1st arduino will be in diy soundbar ajdusting volume level and power on/off relay via ir remote.

2st arduino will be in diy subwoofer ajdusting subwoofer level, bass boost (3 relays) via bluetooth.

Now I would need those two arduinos to communicate with each other so I can ajdust everything via ir and bluetooth.

I would like to avoid I2C (Wire.H) because I will have digital pot on I2C on both arduinos (volume level on first arduino, subwoofer level on second).
I know that I could assign different IDs for both arduinos and digital potentiometers, but it would get too complex for me, I really don`t feel comfortable doint it that way.

I would need values to exchange between arduinos something like:
If relay on first arduino is HIGH send value "1 for example" to second arduino so second arduino knows it can turn relay for subwoofer on and it can send information via bluetooth to my android phone and make all buttons clickable.
If relay on first arduino is LOW send value "2 for example" to second arduino to make subwoofer relay off and send information via bluetooth...

If first arduino receives right code from IR remote to turn relay 2 on second arduino on send value "3 for example" to second arduino to turn relay 2 on second arduino on and that second arduino can send information via bluetooth...
Also I would need to send values that digital potentiometers are set to. Potentiometer have 200 steps for example,
so I would add 100 for example potVal + 100 to make space for lower values (relays) and potVal+300 to make space for first digital pot.

I was thinking that I could define integer on first arduino like:
long int receive;
long int send;

Then I would need other arduino to send command to change value of receive on first arduino.
So then I could use if statements for example:
if (receive == 2)
{
digitalWrite(subRelay, LOW);
}

Thank you

i assume you have 2 Unos. If you don't want to use I2C then you could use SoftwareSerial on each of the Unos to create an extra Serial port.

Have a look at the examples in Serial Input Basics - simple reliable non-blocking ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

They can easily be adapted to use a SoftwareSerial connection.

The technique in the 3rd example will be the most reliable. It is what I use for Arduino to Arduino and Arduino to PC communication.

You can send data in a compatible format with code like this (or the equivalent in any other programming language)

Serial.print('<'); // start marker
Serial.print(value1);
Serial.print(','); // comma separator
Serial.print(value2);
Serial.println('>'); // end marker

...R

Robin2:
i assume you have 2 Unos. If you don't want to use I2C then you could use SoftwareSerial on each of the Unos to create an extra Serial port.

Have a look at the examples in Serial Input Basics - simple reliable non-blocking ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

They can easily be adapted to use a SoftwareSerial connection.

The technique in the 3rd example will be the most reliable. It is what I use for Arduino to Arduino and Arduino to PC communication.

You can send data in a compatible format with code like this (or the equivalent in any other programming language)

Serial.print('<'); // start marker

Serial.print(value1);
Serial.print(','); // comma separator
Serial.print(value2);
Serial.println('>'); // end marker




...R

Thank you, but I got it solved. Moved Bt module to 1st arduino now I will use I2C 1st arduino master and second slave.

Don't forget about Serial. If you replace the Uno with a Leonardo, then you have an extra hardware serial port.
I wrote this yesterday: How to make a reliable I2C bus · Koepel/How-to-use-the-Arduino-Wire-library Wiki · GitHub.
Mayby you can take a look at it to see what you are getting in to.