Community
cancel
Showing results for 
Search instead for 
Did you mean: 
MSull7
Beginner
2,093 Views

Hc-06 Bluetooth to intel galileo problem. Cannot figure out the code

Jump to solution

Hi Everyone,

 

I'm currently trying to figure out how to connect my android phone to my Intel Galileo via the Hc-06(for the past month). My plan is to connect them up to use an app (bluetooth serial app) to drive a rc car. I just cannot get my phone to send the data to the hc-06. I have a very simple start off code which is included below which turns on and off an led and then I hope to go from there, but I cant figure out how to change the code further to use with the hc-06. I have downloaded the Software serial files and connected up everything like I was supposed to. just stuck on the code. Ii will be forever grateful as this is a part off my final year project Thanks!

It's a simple sketch which waits for a character on serial

and in case of a desirable character, it turns an LED on/off.

Possible string values:

a (to turn the LED on)

b (tor turn the LED off)

*/

char junk;

String inputString="";

void setup() // run once, when the sketch starts

{

Serial.begin(9600); // set the baud rate to 9600, same should be of your Serial Monitor

pinMode(13, OUTPUT);

}

void loop()

{

if(Serial.available()){

while(Serial.available())

{

char inChar = (char)Serial.read(); //read the input

inputString += inChar; //make a string of the characters coming on serial

}

Serial.println(inputString);

while (Serial.available() > 0)

{ junk = Serial.read() ; } // clear the serial buffer

if(inputString == "a"){ //in case of 'a' turn the LED on

digitalWrite(13, HIGH);

}else if(inputString == "b"){ //incase of 'b' turn the LED off

digitalWrite(13, LOW);

}

inputString = "";

}

}

1 Solution
NK
New Contributor I
88 Views

HeySullivan, HC-06 is connected to the tx/rx of the galileo, then you should be using Serial1.begin(9600) to initialize the tx/rx between galileo and bluetooth..

Serial and Serial1 are for two different things.Serial is for the /ttyGS0(the one u use to view serial monitor in arduino IDE) whereas the Serial1 is meant for the tx/rx data exchange at the UART pins(0,1) of galileo.

Do let me know if you have any further clarifications required.

Nathan

View solution in original post

5 Replies
idata
Community Manager
88 Views

Hi Sullivan,

 

 

Take a look at the http://www.intel.com/content/dam/support/us/en/documents/Galileo-Edison_ShieldTestReport_330937-002.... Shield Testing Report, page 46, there is an example that includes the SeeedStudio Bluetooth Shield that is based on the HC-06. Try with the sketch included, I think it will give you an idea on how to continue with your project.

 

I'm assuming you are using the Galileo Gen2, is this right?

 

 

Regards,

 

Charlie
JTurn12
New Contributor II
88 Views

Hey Sullivan,

You might try using 115200 baud rate on the Galileo I'm pretty sure.

Also be sure the tx of the hc-05 goes into the rx on the galileo( 0) and the rx to tx.

also,

is that the actual code?

NK
New Contributor I
89 Views

HeySullivan, HC-06 is connected to the tx/rx of the galileo, then you should be using Serial1.begin(9600) to initialize the tx/rx between galileo and bluetooth..

Serial and Serial1 are for two different things.Serial is for the /ttyGS0(the one u use to view serial monitor in arduino IDE) whereas the Serial1 is meant for the tx/rx data exchange at the UART pins(0,1) of galileo.

Do let me know if you have any further clarifications required.

Nathan

View solution in original post

idata
Community Manager
88 Views

Hi Sullivan,

 

 

Have you been able to work on this?

 

Did you check the suggestions above?

 

 

Regards,

 

Charlie

 

MSull7
Beginner
88 Views

Thanks everyone got it going

Reply