Have you looked at http://arduino.cc/en/Tutorial/HomePage ?
It will be near impossible for us to write code for you, we don't know what I/O pins are connected to what, or how to use whatever hardware connected, or even what hardware is connected.
To control the motors, don't even think about connecting directly to the arduino, or you Will fry it.