Programming Arduino with a Motor drive shield

Hi! I'm building a Pan tilt head for my camera and I have a question for my arduino.

I have a Arduino Uno R3 and an Motor Drive Shield L293D and an 5 pin Joystick (GND, +5V, VRx, VRy, SW). I want to control 2 12 v dc motors on the motor drive shield with the joystick and I am new on Arduino so i don't know much about programming yet. :( If someone could help me to program the Arduino / joystick / motor shield so i can control the motors like this joy up = Motor 1 go Forward joy Down = Motor 1 go Backward joy Right = Motor 2 go Forward joy Left = Motor 2 go Backward I would be happy and grateful :)

Thanks in advance :)

Is this the shield you have? https://learn.adafruit.com/adafruit-motor-shield

Have you tried installing the library and following the Using DC Motors tutorial?

Hi, welcome....

Most of us take the approach to help you rather than provide a ready-made solution, so in that spirit have look at these:

A joystick is really just two potentiometers, so start with the potentiometer example.

I don't know that shield specifically, but here is a tutorial on how to drive a motor with the 293 chip, and control speed with a pot.

thanks for fast answer! :)

The Shield i have is this: http://www.ebay.com/itm/170910733083?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2648 and i have install the library for the shield and also tried the joystick examples.

but the thing is I don't know how to program so the joystick control the motors

I don’t know the library for that shield. But I guess it has something to make each motor go forward / backwards and at a particular speed.

So, basically you need to write code to:

read the x-y potentiometer into a variable called (say) XY_val
then map that pot value (which is from 0-1023) to an analog output from 0-255
(see the map function)
Then if the speed is >0, code the shield forward at that speed,
or if it’s <0, backward at that speed.

Okey Thanks! I'll try to do that :)

JimboZA: then map that pot value (which is from 0-1023) to an analog output from 0-255

You wil probably want something like -255 to 255 as your output range.

If you have a "return to center" joystick you may want to put in code to stop the motor if the joystick is close to the center position (which should be close to 512 but not necessarily equal to 512).