Searching for info regarding the PS2X Library

I might be able to explain why both motors go in reverse. I know if I just turn on my controller and don't press the analog button, it goes full reverse. This is because your telling the code to look at the analog stick, get a value and map it for the motors. If the analog button is not pressed, then the sticks output 0 and that in turn is mapped to full reverse.

This could also be done if the controller suddenly cuts off so maybe your adapter is not getting enough current or a stable 3.3 voltage. If you want, you can debug and use some serial prints to see what values are being sent to the robot.

It works!

This could also be done if the controller suddenly cuts off so maybe your adapter is not getting enough current or a stable 3.3 voltage. If you want, you can debug and use some serial prints to see what values are being sent to the robot.

Plugged a 9V into the Arduino and it works fine! I presume when the motors pulling alot of current it was causing voltage fluctuations. The receiver was just cutting out and reading the analog value as zero like you said.

I was hoping to create a fail safe in case the controller disconnects for some other foreseen reason. Ive been testing it by recreating the issue I just resolved.

I tried using the

if(error==1)
{
return;
}

like in your code but it didn't fix the issue.

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.

HazardsMind: 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.

Yes that's what I did. The arduino is running on a 9 Volt alkaline battery and the motors on a 11.1 volt 4500 mah Lipo

Walter