Good night from Spain.
The first thing I would like to do is thank you for all the posts on this forum, and the help they provide in troubleshooting programming issues.
Now abusing your goodwill, I need help to be able to continue my project, I am doing a ROV (Remotely Submersible Operated Vehicle), when you see the code you will see that it is not very different from any other type of robot with sensors.
The idea is that with a PS2 controller, connected to an Arduino Mega 2560, located at the checkpoint I called Maestro, I can send the orders via Serial Communication, to another Arduino Mega 2560, which is inside the vehicle I called Slave, and I can control the engines and turn the lights on and off, and in turn , that the Arduino that is inside the vehicle, send the sensor data to the Arduino checkpoint.
All the sensors that are included in the program, have already been tested individually, with their corresponding program and I have made them work properly. In turn, I have prepared each of them a program to transmit the data from one Arduino to another using serial communication, and they have worked perfectly.
The problems I have when putting the individual codes together in the program that I need to run the ROV, especially with the PS2 controller, which is the one that is giving me the most problems.
I'm sorry I wrote so much, but if I want you to help me, I have to explain my project, so you understand what I want to do.