Dear friends!
According to this discussion:
(my topic)I decided to buy seeed studio bluetooth shield for galileo.Because, normally, the bluetooth module didn't work in Galileo, because it was not supporting seperate bluetooth module.
Today ı have soldered seed studio bluetooth shield and made a connection with arduino.I made an android program for my basic "led blink" circuit and it worked well.
But it didn't work again in Intel Galileo board.I bought it according to Galileo shield testing report , page 41(please check) :Galileo and Galileo Gen 2 Shield Testing Report
I followed all steps and created simple program according to this.
code;
TTYUARTClass* gSerialStdPtr =
&Serial;
TTYUARTClass* gSerialTwoPtr =
&Serial1;
#define DEBUG_ENABLED 1
#define ledPin 13
void setup()
{
pinMode(ledPin, OUTPUT);
gSerialStdPtr->begin(9600);
delay(1000*5);
gSerialStdPtr->println("...Setup 1");
setupBlueToothConnection();
}
void loop()
{
String rev;
char recvChar;
while(1){
if(gSerialTwoPtr->available()){
recvChar = gSerialTwoPtr->read();
rev += recvChar;
gSerialStdPtr->print(rev);
}
if(gSerialStdPtr->available()){
recvChar = gSerialStdPtr->read();
rev += recvChar;
gSerialTwoPtr->print(rev);
}
if ( rev == "1")
{
digitalWrite(ledPin, HIGH);
}
if (rev == "0")
{
digitalWrite(ledPin, LOW);
}
}}
void setupBlueToothConnection()
{
gSerialStdPtr->println("...Setup 2");
gSerialTwoPtr->begin(38400);
gSerialTwoPtr->print("\r\n+STWMOD=0\r\n");
gSerialTwoPtr->print("\r\n+STNA=SeeedBTSlave\r\n");
gSerialTwoPtr->print("\r\n+STOAUT=1\r\n");
gSerialTwoPtr->print("\r\n+STAUTO=0\r\n");
delay(2000);
gSerialTwoPtr->print("\r\n+INQ=1\r\n");
gSerialStdPtr->println("The slave bluetooth is inquirable!");
delay(2000);
gSerialTwoPtr->flush();
}
It transferred to the galileo but I am not able to pair to bluetooth with my androidphone.
Please help me in this situation, My thesis is base on compare arduino uno and Intel galileo.But still ı couldn't able to connect bluetooth with galileo for my robot.
and also arduino code works perfectly here;
#include <SoftwareSerial.h> //Software Serial Port
#define RxD 2
#define TxD 3
#define ledPin 13 //pin we want to blink the led on
SoftwareSerial blueToothSerial(RxD,TxD);
void setup()
{
Serial.begin(9600);
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
pinMode(ledPin, OUTPUT);
setupBlueToothConnection();
}
void loop()
{
char recvChar;
String rev;
if(blueToothSerial.available()){//check if there's any data sent from the remote bluetooth shield
recvChar = blueToothSerial.read();
rev += recvChar;
Serial.print(rev);
}
if ( rev == "1")
{
digitalWrite(ledPin, HIGH);
}
if (rev == "0")
{
digitalWrite(ledPin, LOW);
}
}
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();
}