HC-05 can't send looping data to pc with arduino

Hello everybody,

I have a little problem about sending data via HC-05 bluetooth module to pc with arduino UNO.
My problem is when I compile code to arduino board (code below),

int led = 13;
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(9600); // initialize the digital pin as an output.
while (!Serial) {}
; // wait for serial port to connect. Needed for Leonardo only
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
Serial.println("Communication from Bluetooth");
}

...and then i send data to pc and in pc is received data by Tera term program or Hyperterminal. The problem shows data can't run with loop and sometime can't read data.
How should i do? I don't know this problem is begin from HC-05 or arduino board? or others?
This picture problem you will see below...
Please help me... I'm very new.

cats.jpg

Do you still have the USB cable connected? If so, unplug it.

Here is some background

http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino

thank you Nick for your suggestion,

When I send the data, I unplug usb cable follow basic procedure but this problem occurred.
...and in the first time, a basic result is collect but after that I reconnect and send again its problem unexpectedly occurred.
I don't know what happen? :~

OK, if the USB is DISconnected, the line on the screen is coming via bluetooth, hence the bluetooth is kosher. This is more than can be said for your code, which seems to just flash a LED and send a pointless remark over serial. Junk.
Try the code I posted. It doesn't flash a LED but is probably more useful.

Thank you Nick... I used your code

{
Serial.begin(9600); //note this may need to be changed to match your module
Serial.println("OK then, you first, say something.....");
Serial.println("Go on, type something in the space above and hit Send,");
Serial.println("or just hit the Enter key");
}

void loop()
{
while(Serial.available()==0)
{}
Serial.println("");
Serial.println("I heard you say:");
while(Serial.available()>0)
{
Serial.write(Serial.read());// note it is Serial.WRITE
}
Serial.println("");
}

and I compared the usb serial and bluetooth result. These results shown in the pictures below,

...the problem is occurred when comparing with usb and bluetooth.
I think it about bluetooth interface. Then I re-install both arduino uno and HC-05 and problem occur again.
I don't know why.

I assume what you see in the first picture is what you expect to see - even the one where I guess you hit enter with no text. This proves nothing is wrong with the code or hardware but says nothing about bluetooth.

The second shows the bluetooth is at least paired and transmits. I'm at a bit of a loss to explain why you have transmit and no receive. I'm not familiar with your terminal programme but I doubt the problem lies there. The wiring is obviously not the wrong way round but it could still be suss on Rx.

I used 'Hyper Terminal' to receive the data and I also used 'Tera Term' program.... the problem is same.

and when I choose another code to check an interface between them or wiring or others, I found it again.

I don't know why...
...to be at a loss to do what to know.

In your opinion, Do you think a problem is?
and now I think I will try to buy a new arduino board only to check it, Is this a good decision?, because I have bluetooth module a lot and problem occurred in the same way.
... normal serial interface connect trough usb to pc is send data correctly. Thus in my thinking, the board may failure in bluetooth system.

belivelife:
I think I will try to buy a new arduino board only to check it, Is this a good decision?,

No, it isn't. Arduino is fine. Your picture #1 proves that. When you connect bluetooth all you are doing is changing one serial device for another, no change to Arduino and the software is the same. The only problem can be either

  1. the Bluetooth
  2. the wiring
  3. the procedure.

OR somehting dodgy at the other end. You might try a different PC or an Android phone. An Android is usually easier to connect than a PC.

I follow procedure and fully check again, the result shows problem same previous. :frowning:

However, very thank you for your suggestion and always try to help me.