Arduino to Android JY-MCU pairing but not working

Hi,

I recently started a project using bluetooth communication from an Arduino UNO to my android Droid Bionic and back. I’m new at this but I based everything I did off of a walk through guide found here http://www.instructables.com/id/Android-Arduino-Controlled-Projector-Screen/step6/Bluetooth-Circuit/.

Everything was working perfectly until it suddenly just stopped for no apparent reason. The only lead I’ve had in troubleshooting this problem was an error my arduino IDE returned once when trying to upload a sketch to the board. The error said something like “com 3 already in use”. I then re-installed the software and all was working fine again… or so i thought. Just to clarify, before that, data was being transferred with no problem, but it now seems to not be sending any data at all. Also, a test program that I was using to test my connection by blinking the on board arduino led no longer works for me as it did before, indicating no data being transferred at all, meanwhile my android phone is connecting and paired to my JY-MCU fine, indicated by the modules steady red light.

Why isn’t this working correctly?

Thank you

Arduino Test Code:
// Define Constants and Variables
const int ledPin = 13; // names the on board LED pin
int count; //counting variable for flashing LED
int state;
void setup()
{
// initialize LED Pin as output
pinMode(ledPin, OUTPUT);
// initialize serial communications:
Serial.begin(9600);
// set LED initial state as off
digitalWrite(ledPin, LOW);
// write in LED state
state = digitalRead(ledPin);
}
void loop()
{
// check if serial data is available
if ( Serial.available() > 0 )
{
// write the serial command value
byte command = Serial.read(); // 1 = Blink Fast, 2 = Blink Slow, 3 = Led off
//read the LED state
state = digitalRead(ledPin);
// if the command sent is 1 and LED is off, blink LED fast
if (command == 1 && state == LOW)
{
count = 0; //reset count
while (count < 20 && command != 3)
{
// flashes LED
digitalWrite (ledPin, HIGH);
delay(250);
digitalWrite (ledPin, LOW);
delay(250);
//incrament count
count = ++count;
//check command
command = Serial.read();
}
}
}
}

l1ttledand:
Everything was working perfectly until it suddenly just stopped for no apparent reason.

If the code worked before and you haven't changed anything, it should still work, and the problem is more likely elsewhere. Is the USB cable still plugged in? If so, remove it.

Thanks for the response, It definitely should be working. That’s why I’ve spent hours trying to figure out why its not. I already tried USB unplugged using external power supply, same result. I checked all the wires and they’re set up correctly. I’ve been searching through forums looking for others who have this problem and I’ve found a few with the same occurrence but no solution. I ordered a new JY-MCU to see if that’s the problem, if maybe i fried it, but I doubt I did. I also wondered if the Arduino was the problem, but it works properly, loading other sketches and all. Then I wondered if it was the phone, so I tried several phones with several apps, including the two which worked at one point. Nothing. The only problem is data not being transferred. A communication not being made. So… it must be the module, right? If anyone has a solution, suggestion or comment, it will be much appreciated!

You should be in a position where the serial monitor should operate exactly as the bluetooth, so you can test everything with the cable and monitor. Once proven that far, the Arduino is kosher, and that is all you can do at the Arduino end.

Now disconnect the cable and go to bluetooth. All the fiddling is now at the Androiod end.

I suspect some of this depends on the Android device. My tablet sees the Arduino but refuses to talk to it. My Android phone works fine. In both cases I used BlueTerm. I tried something else on the phone. It works but I'm sticking with BlueTerm.

I suspect that, if one bluetooth app works on an Android, they all will and, if one won't, no amount of app swapping will save you. I initially proved the Arduino was innocent by getting bluetooth connection with a laptop running RealTerm. If the problem persists, you might try using alternative device. Note that you can run serial monitor on a desktop simultaneously with bluetooth on a laptop.

Thank you for your response but the new module I ordered worked correctly! I guess I may have burnt the first one out or something but everything is working now. Thanks for the help.