Arduino Forum

Topics => Robotics => Topic started by: shaikhhammadali on May 01, 2019, 08:03 pm

Title: serial communication between two arduino to control servos
Post by: shaikhhammadali on May 01, 2019, 08:03 pm
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.
Title: Re: serial communication between two arduino to control servos
Post by: vinceherman on May 01, 2019, 08:58 pm
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. (https://forum.arduino.cc/index.php?topic=421081.0)
Title: Re: serial communication between two arduino to control servos
Post by: shaikhhammadali on May 01, 2019, 09:27 pm
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. (https://forum.arduino.cc/index.php?topic=421081.0)
no i want a wired i2C communication,
i just dont know how to use Serial.write and read command. Kindly help me with that
Title: Re: serial communication between two arduino to control servos
Post by: vinceherman on May 01, 2019, 09:40 pm
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.
Title: Re: serial communication between two arduino to control servos
Post by: Idahowalker on May 01, 2019, 09:40 pm
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.
Title: Re: serial communication between two arduino to control servos
Post by: shaikhhammadali on May 02, 2019, 05:11 pm
thanks everyone, i just sort this thing out. it wasnt that tough... :-p