i2C master write and slave receiver programming

Is that possible to make 2 arduino UNO function like Arduino MEGA(ATmega2560). For example an Arduino UNO contain 14 I/O pins. I’m synchronizing both Arduino to control 2 Motor driver module which each of the Arduino UNO board controlling a single motor driver module. For sure there will be one master write and another will be slave receiver. is that able to code for the first Arduini UNO to control 1 motor driver module and the second arduino UNO controlling another motor driver module in synchronization mode? Im actually doing an autonomous robot which contain 4 DC geared motor, 2 motor driver module, 2 arduino UNO. Which both of the arduino and motor driver module synchronize together to spin the DC geared motor in sequenced. Need help in this i2c part. hopefully there will be someone who help me out

What are the 4 motors doing? Why do they all need to be in sync? What does in sync even mean? Running at the same speed? Having rotated the same amount?

How will one Arduino know what the motors that the other one is driving are doing?

Specifically, what data are you sending over I2C?

What problems are you having with the code you didn't post?

i sent u a pm

Dennisfoo:
i sent u a pm

I accidentally deleted it while trying to reply. Can you post here, instead?

okay. first of all. im trying to create an autonomous vacuum cleaner which the robot have 4 wheels to move. The motor driver module that i used can connect with 2 DC geared motor. I tried to use one arduino UN to connect 2 motor driver module using 3.5V and 5V port from the arduino to the motor drier module. for 5V it functioning well hut for 3.5V it fail to function. Thats i why im using 2 arduino to control 2 motor driver module. As it is an autonomous robot i use ultrasonic and R sensor to make it move automatically. But now the problem is if i didnt sync this 2 arduino. the direction of the front wheels and back wheels will be corrupted. Im having an idea which first arduino connect to the sensor, motor driver and DC gared motor. for second arduino I just connect to a motor driver module and 2 DC geared motor.

I tried to use one arduino UN to connect 2 motor driver module using 3.5V and 5V port from the arduino to the motor drier module.

I don't understand this. You can connect any number of things to the 5V pin, as long as all the things do not draw more current than the 5V pin can provide.

but for 3.5V it fail to function.

Well, I'm not surprised. Motor driver (shield)(s) typically need 5V input if the PWM pins and direction pins are getting 5V.

You may have a hard time stacking two motor driver shields, unless the shield has jumpers which let you choose which pins they use.

the direction of the front wheels and back wheels will be corrupted.

Again, I don't understand. Aren't the front wheels parallel to the back wheels? I can see that the two sets of wheels might not spin at the same speed, but that should have nothing to do with the direction of the wheels.

Again, I have to ask. What, exactly, should one Arduino tell the other?

Lets call the two Arduinos front and back. The one called front drives the front wheels. The one called back drives the back wheels. Which one are the ultrasonic sensors connected to?

What should front, if it is the master, tell back, if it is the slave? What should front do if it tells back to do something, and back doesn't do it? How will front know whether or not back did what it was told? How will front know that back did the right thing? That is, suppose front tells back to set the motor speed to 200. If back sets the motor speed to 200, and front sets the motor speed to 200, there is NO guarantee that the two sets of wheels will turn at the same speed. So, front needs to know what speed back's wheels are turning at, so it can adjust it's speed (which is needs to know, too) or tell back to adjust it's speed.

So, one again, I have to ask. What, exactly, should one Arduino tell the other?

You need to decide all this before you fire up the IDE and begin pasting code.

What if i make it like this for the front wheels i code it to one arduino with 1 ultrasonic sensor and 2 R sensor. then for the back i will use the same idea without synchronize them. is it okay?

the first arduino UNO actually is to tell the 2nd arduino to move the same direction. For example. Ultrasonic sensor/ir sensor detect obstacles it will tell the second arduino to turn left or right. All the sensor will be attached in first Arduino. For DC geared motor there will be 2 DC geared motor will be attached on each Arduino UNO.