# Arduino + WIi nunchuck + DC motor control

Hey! I have some code to read the accelrometer data from a wii nunchuck. I am able to use this data to control servos (pan/tilt) But i was wondering how i could use it to control two dc motors on my robot, so i that i can steer and control speed only using the accelerometer. I dont need anyone to write me any code just and idea of how i would do it... Thank you!

it uses tank like steering!

It should be a matter of putting the joystick data in the right spots and change a few variables.

Seems helpful but i do not understand what everything does in the code!

First what is the maximum range you get from the joysticks? Also what is the number you get when you don't touch the joystick at all?

These two numbers are needed to make this code work properly.

LEFT = 30 MID = 125 RIGHT = 225

What about forward, reverse and center?

Judging from your left to right values. You could use the map() function and map your values (30 - 225) to (0 - 1023)

I think i know what to do now! Can you just help me with something...

Say i have to values and i want them to be inversely proportional

Eg. i have a two dc motors going at the same speed to drive a rover forward but as i turn i want one speed to increase while the other decreases at the same rate, as if to make the robot turn at a increasing speed... I hope you get what i mean!

Thanks!