Go Down

Topic: Problem with Arduino Uno and Bluetooth module Pro (Read 504 times) previous topic - next topic

Hello,
I have a strange problem regarding a project of mine. I'm using an Arduino Uno and a bluetooth module Pro. The code that I am testing is below:
Code: [Select]
#include <SoftwareSerial.h>


String contentblue = "";
char characterblue;
String content = "";
char character;

SoftwareSerial bluetooth(3, 2);

void setup() {
  Serial.begin(115200);
  delay(1);
  bluetooth.begin(115200);
  delay(1);
}

void loop() {
 
  while(Serial.available() > 0){
    character = Serial.read();
    content.concat(character);
    delay(1);
  }
  if(content != "") {
    Serial.println(content);
    bluetooth.println(content);
    content = "";
    delay(1);
  }
 
  while(bluetooth.available() > 0){
    delay(1);
    characterblue =(char) bluetooth.read();
    delay(1);
    contentblue.concat(characterblue);
    delay(1);
  }
  if(contentblue != "") {
    Serial.println(contentblue);
    contentblue = "";
    delay(1);
  }
}





So I'm expecting when I type AT in the Serial monitor to get a response from the bt module like OK. The problem is that I'm getting only weird characters like these in the picture (attachment).
Any ideas ?

Thank you in advance,
Alex

Did your bluetooth module works in AT Command with 115200? Normaly they use 9600 or 19200.

Why not just use this?
Code: [Select]
void loop() {
 
  while(Serial.available() > 0){
    character = Serial.read();
    Serial.println(content);
    bluetooth.println(content);
    delay(1);
  }
 
  while(bluetooth.available() > 0){
    characterblue =(char) bluetooth.read();
    Serial.println(contentblue);
    delay(1);
  }

}

Hello and thank you for your reply.. Yes my module works with 115200 baud rate I have checked that. The module that I am working with is this: http://www.cooking-hacks.com/bluetooth-module-pro-for-arduino.
When I use it without Software Serial (in combination with an xbee shield in order to connect it to the arduino) it works fine using 0,1 pins of arduino. The problem occurs when I use the module (without xbee shield).

Thank again in advance. 

In that link they say the speed is 38400. But if you test it  with 115200 i will say the speed is not the problem.

Do you know the shied is important? The bluetooth module works with 3.3V, Vcc and TX RX. If you connect it directly did you had this in consideration?

Go Up