Dear all,
I am trying to get a Bluetooth Bee (seeedstudio.com/depot/blueto … Path=19_21) working on a Rainbow Cube with Rainbowduino V3, but when trying to discover the Bluetooth Bee on my Android phone it is not visible.
I have put the Bluetooth Bee in place at the Bee headers of the Rainbow Cube motherboard, and I have soldered jumper cables in the wholes in the Rainbow Cube motherboard that connects to ground, Tx, and Rx at the Bee connector. The ground cable is then connected to ground at the Rainbowduino mail header, Tx at Rainbowduino is connected to Bee Rx, and Rx at RainbowDuino is connected to Bee Tx. Further, I have but the USB/Host switch in the Host position, after having programmed the RainbowDuino.
The Rainbowduino code is at the bottom.
Thanks in advance for any help.
Best regards, Marius
#include <Rainbowduino.h>
void setup() {
Rb.init();
Rb.blankDisplay();
setupBlueToothConnection();
}
char a;
void loop() {
if (Serial.available()) {
if (Serial.read() == ‘a’) {
Rb.setPixelZXY(3, 3, 3, 255, 255, 255);
}
while( (a = Serial.read()) != -1) {
//Wait until all other response chars are received
}
}
delay(100);
}
void setupBlueToothConnection()
{
Serial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
delay(1000);
sendBlueToothCommand("\r\n+STWMOD=0\r\n");
sendBlueToothCommand("\r\n+STNA=LEDCube\r\n");
sendBlueToothCommand("\r\n+STAUTO=0\r\n");
sendBlueToothCommand("\r\n+STOAUT=1\r\n");
sendBlueToothCommand("\r\n+STPIN=5934\r\n");
delay(2000); // This delay is required.
sendBlueToothCommand("\r\n+INQ=1\r\n");
delay(2000); // This delay is required.
}
//Checks if the response “OK” is received
void CheckOK()
{
char a,b;
while(true) {
if(Serial.available()) {
a = Serial.read();
if('O' == a) {
// Wait for next character K. available() is required in some cases, as K is not immediately available.
while(Serial.available()) {
b = Serial.read();
break;
}
if('K' == b) {
break;
}
}
}
}
while( (a = Serial.read()) != -1)
{
//Wait until all other response chars are received
}
}
void sendBlueToothCommand(String command)
{
Serial.print(command);
CheckOK();
}