Go Down

Topic: serial communication between two arduino to control servos (Read 315 times) previous topic - next topic

shaikhhammadali

hi there,
beginner here
i have an arduino uno and a Nano.
on UNO i have connected a servo with a pot and uploaded sweep code to move servo,
in Nano i have another servo connected.
Now i want to transfer UNO's servo(master) data to Nano's servo(slave) via serial communication.
so that the slave servo moves exactly the same way as mater servo.
can anyone pleaaaase write me the code for this.

vinceherman

can anyone pleaaaase write me the code for this.
Much better is to have you write the code.
We can help you with this.  But you have to make an effort.
Have you selected what hardware will permit the serial communication between the 2 arduinos?

Edit: Assuming you want wireless communication, here is some food for throught.

shaikhhammadali

Much better is to have you write the code.
We can help you with this.  But you have to make an effort.
Have you selected what hardware will permit the serial communication between the 2 arduinos?

Edit: Assuming you want wireless communication, here is some food for throught.
no i want a wired i2C communication,
i just dont know how to use Serial.write and read command. Kindly help me with that

vinceherman

Kindly help me with that
Absolutely.  We do that a lot here.
Have you googled it?  That is a good first step.  See what other people have done.
I googled "i2c between 2 arduinos"
One of the hits was an arduino tutorial named Master Writer/Slave Receiver using the Wire arduino method.
Go take a look and see if that meets you needs.

Give it a try.  If you get stuck, post your code here (using code tags), tell us what you expected to happen, what actually happened and how those two differ.

Idahowalker

Have you done any searching for what you want? Such as using your favorite search engine and typing words and then selecting enter?

What made you decide on I2C?

Have you added a library for a device, using I2C, loading the library files into the Arduino IDE and looking at how others have used I2C? I am sure that is going to save you money over having someone write the code for you.

shaikhhammadali

thanks everyone, i just sort this thing out. it wasnt that tough... :-p

Go Up