0

I am trying to get my Arduino UNO to communicate with a Bluetooth Module (Bluetooth Bee), but I am getting a weird behaviour from the device. First, there are no leds blinking on the board (which I think there should be). Second, every time I send an AT command to the board I get ERROR: (0) which apparently is the caused by an invalid AT command, but it happens as I am sending just "AT" which should return "OK".

The Arduino code:

#include <SoftwareSerial.h>
SoftwareSerial BT(10,11); 

void setup()  {

    BT.begin(38400);
    Serial.begin(9600);
    BT.print("\r\n+AT");
}

char a; // stores incoming character from other device

void loop() {

    if (BT.available())  { 
        a=(BT.read());
        if (a=='\n') Serial.println((char)(a));
        else Serial.print((char)(a));

    }

}
  • The default serial baud rate is 9600 - you have changed it? If not, try setting the arduino rate to 9600 instead of 38400. – Mark Williams Jul 27 '15 at 10:01
  • I am sending just "AT" . It seems you are actually sending +AT. I'd also try moving the \r\n to the end of the string, instead of the beginning. – Gerben Jul 27 '15 at 12:33
  • Maybe this will help - cheers diwo.bq.com/wp-content/uploads/2014/11/… – szaw Dec 30 '19 at 5:09

Browse other questions tagged or ask your own question.