I have Arduino UNO + Motor Shield. And I have attached the JY_MCU board (Bluetooth) to it.
I am sending data (the commands) to the Arduino through Bluetooth. The JY_MCU board accepts it and executes the command, (the motor control).
In order to receive the command I use:
#include <SoftwareSerial.h>
SofrwareSerial mySerial(0,1); // RX, TX pins
...
// in setup function
mySerial.begin(9600);
...
// in the loop function
if (mySerial.available()) {
...
}
etc
The problem is that after some time the Arduino stops responding to the commands being sent to it. However the red LED on the
Bluetooth board doesn't blink, indicating that the connection still exists.
I have decided, in order to debug the problem, to output the commands received by bluetooth using Serial.println function:
// in setup function
Serial.begin(9600);
...
// at several places in the code
Serial.println(command);
...
And after I have put that function to several places in my code, the program started to work as it should work without any mistakes or sudden stops in receiving the commands.
What is the problem? I can't understand.