Master/Slave communication

What I see from the OP looks very like someone has done cut&paste of I2C code but does not understand use of simple serial or blinking led13 or even that without output it is impossible to tell if the chip is doing anything but conducting electricity.

MorganS:
"Using" is a strong word: the slave programs shown so far still don't do anything with the data so it's a Shroedinger's Cat type of problem.

I think the original advice (from elsewhere) was flawed: this appears to be a distributed manufacturing project and I2C won't work at all if the distance between the slaves and masters is more than a meter. Maybe it's for very small 3D printers?

I actualy want to build a cnc machine and use Arduino as controllers. As i can imagine the distance of Slave Arduinos won't be up to one meter but the distance of Master Arduino from the Slaves would be greater than one meter. How could this be a problem?

UKHeliBob:
I can't help feeling that you are a little confused.

The truth is tha i'm a bit confused that's why i asked help from you.

The truth is tha i'm a bit confused that's why i asked help from you.

Tackle the project in stages.

Start by establishing serial communication between the PC and a Arduino so you can enter text manually on the PC using Hyperterminal and see it on the Arduino Serial monitor.

Come back when you have that working.

I2C was originally designed for various chips on one PCB to talk to each other. It has been extended a lot since then but it is still limited.

It is quite sensitive to the capacitance of the wires you use. Longer wires have more capacitance so that defines the length limit.

I have had good luck with SPI over distances of 3-5m but other people have had problems at that length.

Older interfaces like RS232 and RS485 are more suitable for an industrial environment with motors giving off lots of interference. That requires more hardware than just bare Arduinos.

MorganS:
I have had good luck with SPI over distances of 3-5m but other people have had problems at that length.

Is that using the default clock divider of 4? (512KB/sec)

I'd expect dropping the rate should get some extra bus length.

Yes, you are right and it's not difficult to do the calculations to work out how long you can get at each rate.