Hi All!
I’m have some problem when try serial bluetooth connection and fastLED. I’ve use Daniel’s code (http://funkboxing.com/wordpress/?p=2154) but it does’t work properly.
I use an arduino pro mini and a seeed serial bluetooth module (http://www.seeedstudio.com/wiki/Grove_-_Serial_Bluetooth).
The code what i use: http://pastebin.com/gTNkfJzc
I can find the bluetooth with my phone the pair is ok also, but when i try to modify something from the app, it doesn’t do anything.
Shoud somewone help me? Thanks a lot.
I now it’s probably obvious, but did you remember to cross the rx and tx lines?
Also did you set the baud rate on the bt breakout board? The sketch is set to 57,600 and most are set to 9,600 out of the box.
first you have to setup your BT module to the desired parameters
void setupBlueToothConnection()
{
blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
blueToothSerial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as “SeeedBTSlave”
blueToothSerial.print("\r\n+STPIN=0000\r\n");//Set SLAVE pincode"0000"
blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
//blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
delay(2000); // This delay is required.
blueToothSerial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable
Serial.println(“The slave bluetooth is inquirable!”);
delay(2000); // This delay is required.
Serial.println(“2 seconds passed”);
//char recstatus;
//blueToothSerial.print("\r\n+RTSTA:XX\r\n");
// recstatus = blueToothSerial.read();
//Serial.print(recstatus);
blueToothSerial.flush();
}
@Jeremy_Spencer Yes, i remeber, double cheked the wireing, and it’s correct.
At the end of the code there is the setup for the BT module and there is also a line for the baud rate.
@Juergen_Bruegl At setup i have: void setup()
{
Serial.begin(SERIAL_BAUDRATE); // SETUP HARDWARE SERIAL (USB)
Serial.setTimeout(SERIAL_TIMEOUT);
setupBlueToothConnection();
btSerial.begin(SERIAL_BAUDRATE); // SETUP SOFTWARE SERIAL (USB)
btSerial.setTimeout(SERIAL_TIMEOUT);
And in the main loop there is
void setupBlueToothConnection()
{
btSerial.begin(57600); //Set BluetoothBee BaudRate to default baud rate 38400
btSerial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
btSerial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as “SeeedBTSlave”
btSerial.print("\r\n+STPIN=0000\r\n");//Set SLAVE pincode"0000"
btSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
btSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
delay(2000); // This delay is required.
btSerial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable
Serial.println(“The slave bluetooth is inquirable!”);
delay(2000); // This delay is required.
btSerial.flush();
}
my BT module was picky with the baud rate
That’s what I’m using:
void setup() {
Serial.begin(9600);
setupBlueToothConnection();
blueToothSerial.begin(38400);
}
void setupBlueToothConnection() {
btSerial.begin(38400);
…
I also commented out the Auto-connection
Thank you @Juergen_Bruegl , it’s working now. Thanks so much for your help!