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));
}
}
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 at 12:33