Hi everyone, I just bought a bluetooth from seeedstudio.com. I tried to follow the manual to use bluetooth command as slave, and change the name, and baudrate..but no luck. And I also tried this code below.
void setup()
{
Serial.begin(9600); //Set BluetoothFrame BaudRate to default baud rate 38400
delay(1000);
setupBlueToothConnection();
}
void loop()
{
if(Serial.read() == 'a')
{
Serial.println("You are connected to Bluetooth Frame");
//You can write you BT communication logic here
}
}
void setupBlueToothConnection()
{
sendBlueToothCommand("+STWMOD=0");
sendBlueToothCommand("+STNA=SeeeduinoBluetooth");
sendBlueToothCommand("+STAUTO=0");
sendBlueToothCommand("+STOAUT=1");
sendBlueToothCommand("+STPIN=0000");
delay(3000); // This delay is required.
sendBlueToothCommand("+INQ=1");
delay(3000); // This delay is required.
}
//Send the command to Bluetooth Frame
void sendBlueToothCommand(char command[])
{
Serial.println();
delay(200);
Serial.print(command);
delay(200);
Serial.println();
delay(1000);
Serial.flush();
}
I think the code above should rename the built in name to 'SeeeduinoBluetooth' once it is running...but it displays on my phone the original name when scanned, can anyone here help me out what I'm missing?
Thanks in advance,
ardbanon