Need Help Big Noob PS2/MD10R2 Shield

Hello everyone !
I’m french ( sorry if my english is not better ) and i’m big noob with arduino script…
I want to create a WD Robot with :
-4 motors : Cytron Power Window Motors w/ 5" Wheels (Pair) - RobotShop
-4 shield : Cytron 10A DC Motor Driver Arduino Shield - RobotShop
-1 Arduino mega 2560
-1 ps2 controller dualshock

My problem ? all is ok with the soft for my ps2 controller, but i don’t know what I had to write on the soft to control my shield with my dualshock2…
anyone can help me ? If you come to france I paid you with lot of beer :wink: <3
I my ideal, I want to control my motors with analog up,down,left,right

PS2X_lib.h (7.59 KB)

Robot.ino (6.8 KB)

If you come to france I paid you with lot of beer :wink: <3

You are certainly talking MY language! :smiley:

I suggest that you work on the project in discreet parts.
You have the controller working? Great!
Now, in a completely separate sketch, work on making your motors run.
Make one motor run at slow speed for a short time.
Then run at a higher speed for a short time.
Then stop for a short time.
Then run the other direction for a short time.
Then stop.

After you get that working, have it repeat for the other motors.

After you have all 4 motors working, then try adding in the controller code.

Have problems along the way? Ask!
A good place to start is with the examples that are usually included with the library for the motor driver.

Edit: I read through the instructions for the motor drivers. Stackable, and jumper selectable pin configurations for direction and pwm. This all looks doable.

What pins does your controller use?

thank you for your short reply !
We can use digital port from 2 to 9 ! ( i only use 10,11,12,13 for ps2 controler )
but I don’t know how to write on the script to control they shield (md10 r2 cytron ) … sorry i’m big noob …

I just need the script to said " I push on up button -> go front" " i push on back -> go back" etc... it's so easy for people who know... but for begginer it's hard ( I take 12h of my time today for that joke... so funny with no help ! )

I just need the script

This is the part of the forum where we help you write code.
If you want someone to write your code for you, there is a part of this forum specifically geared toward that.
Gigs and Collaborations
You explain what you want done. Then you negotiate a mutually agreeable price you are willing to pay to have that work done.
Many people go that route.

If, however, you are willing to put in some effort to learning, we can help here.

As I said above, on the page you linked to;

There is a section named Useful Links
It contains a PDF that is the manual for the motor controller.
Read that PDF.
It also contains a zip file with example arduino code.
Load up that code.
Plug in one shield to your arduino and wire up one motor and the power supply.
See if you can make one motor move according to the code in the example.

This code will not have the controller involved at all.
Make the motor run from the example code.
Let us know how you do.

like vinceherman said, if you get it to work without the controller in babysteps, then you can just integrate the parts in the controller sketch and TADAAA it works. this way you can also troubleshoot a bit better because during your testing phase you can set the vars to the values you want to have to test a predicted outcome.

i am trying to get a project working my self and although the controller was "working" (printing different lines when different buttons are pressed or released) i sonn had to learn that thats not all there is to it...

so i hiiighly recommend as well to use the examples and one or two tutorials on youtube for that shield and you will be much wiser after that. and if it still doesnt work, you can post your code and people will help you fix it and (hopefully) explain as well why it doesnt work.

(i learn way more from the explenations! just getting a solution without any comment is just a short term fix, but next time i will be stuck again without having a clue how to fix it)