Go Down

Topic: Serial Communication (Read 538 times) previous topic - next topic

N314

I am building a remote control robot with two aruinos(UNO), and a RF link. You put serial data in the transmitter and it comes out the reciever. I need to control two motors(with PWM). Any ideas on how to control two motors with PMW capabilities through a serial interface?

James C4S


Any ideas on how to control two motors with PMW capabilities through a serial interface?

There are tons of tutorials on how to control motors and how to communicate over serial.  So what is your specific question?
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

N314

I know how to control motors. I need to send two numbers, one for each of the motors, but how can I make code to tell which number(from serial connection), goes to which motor. Like... Left motor PWM 200, and right 100. How can I send serial data and differentiate the two values for the two motors?

WizenedEE

Think about how you'd tell another person two values.

I'd say, "The first value is 38 and the second value is 97." So, why don't you have your arduino do it, but with more concise phrases than "the first value is" (maybe "1" or "a")

It's also usuallly a good idea to send a signal at the start and end of each message - so your message may look like "b1[motor1value]2[motor2value]e"

Then you'd send it with Serial.write(), and read it, one letter at a time, with Serial.read().

N314

I understand that part. I need to know how to interpret and then make use of the serial data.

Go Up