So I am having a problem with a project that I am developing.
So basically I am developing a car that is controlled with a remote control (which has 3 buttons, a Potentiometer and a joystick) which can shoot a nerf dart, use 2 wheels (controlled with DC motors) and lights. Also it is supposed to read an HC SR04 sensor and a light sensor, but that does not matter now.
I am using two NRF24L01 modules to communicate,
The code compiles, but after a while the communication simply freezes and I have to reset it.
By the way, I am using an arduino mega 2560 r3 for the car and a arduino uno r3 for the controller.
This is the code for the car
https://gist.github.com/ddmdavid/9b7d59a786ec570c1c5440f854dab2f1
This is the code for the controller.
https://gist.github.com/ddmdavid/424de0873eccbbcb7892f2edb51b7be9
This is what is printed in the serial monitor of the car:
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,506,495
0,0,0,0,506,495
0,0,0,0,505,495
0,0,0,0,506,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,506,495
0,0,0,0,506,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,506,495
0,0,0,0,506,495
0,0,0,0,505,495
0,0,0,0,506,495
0,0,0,0,506,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,506,495
0,0,0,0,506,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,506,495
0,0,0,0,505,495
0,0,0,0,506,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,506,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,506,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,506,495
0,0,0,0,506,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,506,495
0,0,0,0,506,495
0,0,0,0,506,495
0,0,0,0,506,495
0,0,0,0,505,495
0,0,0,0,506,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,505,495
0,0,0,0,505,438
0,0,0,0,506,4
0,0,0,0,505,3
0,0,0,0,506,3
0,0,0,0,505,4
0,0,0,0,506,4
0,0,0,0,506,4
0,0,0,0,506,4
0,0,0,0,506,4
0,0,0,0,506,4
0,0,0,0,505,4
0,0,0,0,506,3
0,0,0,0,506,495
PS. I am a newbie when it comes to programming, just to let you know.
codeForTheCommand.ino (2.91 KB)
