Robot Tank problems

Hey theres an error in my code and I believe its causing my problems, it could also be my power setup but idk.
my motors won’t run. rest such as laser works and can be controlled with square button on Ps2 remote.
this is for my school project, each provided photo has info on it. If someone could help that would be great thanks.



PS2X_lib.cpp (10.2 KB)
PS2X_lib.h (5.96 KB)
Tank_Code.ino (13.1 KB)

Hi,

First thing to do to troubleshoot the issue would be to disconnect all the sensors and PS2 Receiver and verify if you can control the rover’s motors with only the Arduino board + Motor Driver with a simple motor driver Arduino code.
You can use the DFRobotShop Rover Arduino code here (with some adaptation).
As soon as you confirm that there are no issues with the Arduino + Driver + Motors setup, you can add one sensor at a time and the PS2 Receiver (with the PS2 Controller Arduino code) at last.
Also, are you powering the Motors Driver + Arduino Board with 6V ? If that’s the case, you might want to separate the Arduino and the Motor Driver’s power supplies. Try to power the Arduino with a 9V battery with this 9V Battery Holder and the Motor Driver with 4 x AAs Batteries.

Hope this helps,