Arduino Uno + Bluetooth module ,,, not working

i need help with my project

i have arduino uno connected to this Bluetooth module

http://www.lctech-inc.com/Hardware/Detail.aspx?id=684fb223-1a23-4b83-8dbd-4d58c2b3c0cb

this is the code i tried

char incomingByte;  // incoming data
int  LED = 13;      // LED pin
 
void setup() {
  Serial.begin(9600); // initialization
  pinMode(LED, OUTPUT);
  Serial.println("Press 1 to LED ON or 0 to LED OFF...");
}
 
void loop() {
  if (Serial.available() > 0) {  // if the data came
    incomingByte = Serial.read(); // read byte
    if(incomingByte == '0') {
       digitalWrite(LED, LOW);  // if 1, switch LED Off
       Serial.println("LED OFF. Press 1 to LED ON!");  // print message
    }
    if(incomingByte == '1') {
       digitalWrite(LED, HIGH); // if 0, switch LED on
       Serial.println("LED ON. Press 0 to LED OFF!");
    }
  }
}

iam using windows 8 ,,, i have the following problem :
the projects works fine while connecting the arduino via usb cable & the serial monitor works fine but when trying to connect via laptop bluetooth i got 2 serial ports " com 8 " for incoming ,,, "com 9" for outgoing & nothing happen ,,, i couldn't send or receive anything via the terminal

Have paired the arduino with the laptop?
Do you see flashing lights on the bluetooth module, and if so, what is the frequency?
What terminal pprogramme are you using on the laptop?

Nick_Pyner:
Have paired the arduino with the laptop?
Do you see flashing lights on the bluetooth module, and if so, what is the frequency?
What terminal pprogramme are you using on the laptop?

yes i have paired the arduino with my laptop & it shows 2 serial ports for the bluetooth

the lights on the bluetooth are flashing ,,, if you mean by frequency the baud rate it is " 9600 "

the terminal program is tera term http://ttssh2.sourceforge.jp/

jo_2010:
the lights on the bluetooth are flashing ,,, if you mean by frequency the baud rate it is " 9600 "

the terminal program is tera term

No I meant the led on the module. A slow flash 1hz meant it was working. A much faster flash just meant the power was on and it was idling. I use RealTerm and 9600 bd was fine.

Nick_Pyner:

jo_2010:
the lights on the bluetooth are flashing ,,, if you mean by frequency the baud rate it is " 9600 "

the terminal program is tera term

No I meant the led on the module. A slow flash 1hz meant it was working. A much faster flash just meant the power was on and it was idling. I use RealTerm and 9600 bd was fine.

the led on the bluetooth are flashing slow after pairing with laptop but still nothing on terminal

can your phone pair with the bt module? if so, can you control the arduino by inputting command from smartphone bt terminal? I personally have been working on this module for 2 days, finally figured out how it works.

I have a similar problem with the same BT module.
When I try to pair it with my notebook (windows 8), the pair seems to be ok (because the led flash slow), but after few seconds, windows show an "offline" status (see attachment #1).
When I try to pair it with my smartphone (android 4.0.4, sony xperia u), the pair seems to be ok too, but when I try to connect with a terminal (blueterm), it show the error "unable to connect device". Same problem with amarino 2.0

any idea?

thank you

it is quite strange that with the same wiring and sketch, my bluetooth module works fine with my duemilanove, but not with the UNO. Then after days of digging, I found out that I have to use software serial library to get UNO and bluetooth to communicate, you can try if this work for you.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup()  
{
  // Open serial communications and wait for port to open:
  Serial.begin(57600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(4800);
  mySerial.println("Hello, world?");
}

void loop() // run over and over
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}

Thank you, but I already use that sketch...
Communication between Arduino and BT module is fine, the problem is that for some reason I can't understand, the BT module can't connect successfully after pairing with another device (pc or smartphone).

These things can be a bit flakey.

My Arduinos talk perfectly to my laptop via bluetooth. It is the only communication I have with them at the moment.

My dumbphone can pair with Arduino but cannot do anything.

My Android tablet with BlueTerm can pair with Arduino but cannot do anything. That is very disappointing. I have not persued this as my laptop is fine and hardly less convenient than a tablet, and the tablet is really junk.

My desktop can see my phone and my tablet but cannot see the Arduinos.

In short, all the problems lie with the peripherals, not Arduino.

I fail to see the need to use software serial library to get UNO and bluetooth to communicate. I don't think anybody else does. I only use bluetooth for data aquisition, but no extra software of any sort is required to do this.

Nick_Pyner:
I fail to see the need to use software serial library to get UNO and bluetooth to communicate. I don't think anybody else does. I only use bluetooth for data aquisition, but no extra software of any sort is required to do this.

I use SoftwareSerial so I can get 2 serial port: from arduino to pc with usb and the other one form arduino to BT module.
In that way, when I set BT module in command mode, I can send AT commands from pc to bt using arduino as proxy because I don't a FTDI cable.

Now I can connect successfully from Windows 8! I achieved that installing Toshiba Bluetooth Stack from http://aps2.toshiba-tro.de/bluetooth/?page=download-toshiba (I read something about that somewhere on Internet).

But the problem is still present with my Android phone.

Nick_Pyner:
I fail to see the need to use software serial library to get UNO and bluetooth to communicate. I don't think anybody else does. I only use bluetooth for data aquisition, but no extra software of any sort is required to do this.

My UNO responses to BT only if i use the software serial library. I don't know why, but my duemilanove is okay without it. it's kind of strange.

Eventually I solved my second problem: it's my idiot-phone (Sony Xperia U)! Please don't buy it, it's the worst android phone I've evere seen!!
The HC-05 connect successfully with Samsung S2 and S Advance, so I need to change my phone to accomplish my project...