Searching for info regarding the PS2X Library

What you should do is have two power supplies, one for the motors and the other for the arduino. NOTE make sure you connect the ground on the arduino to the ground for the motors. Or simple the negative battery terminals together.