Quantcast
Viewing all articles
Browse latest Browse all 18089

Bluetooth as Master on the Galileo

Hello I am using the iteadstudio bluetooth shield, and I wanted to configure it as a master via sending commands using HardwareSerial library but it doesn't seem to work.

 

This is the code I have

 

Serial.begin(CBR_9600, Serial.SERIAL_8N1);  executeCmd("AT+ROLE=1");  executeCmd("AT+INIT");

String executeCmd(String command)
{
  inq.clear();    Serial.println(command);    int MAX_INPUT = 1000;    char input_line [MAX_INPUT];    unsigned int input_pos = 0;   while(1){  if (Serial.available()){        char inputByte = Serial.read();
 switch (inputByte)      {        case '\n':        input_line [input_pos] = 0;        input_pos = 0;        Serial.println(input_line);        break;      case '\r':        break;      default:        if (input_pos < (MAX_INPUT - 1))          input_line [input_pos++] = inputByte;        break;      }  }   }
}

 

The serial.aviable() is always false, has anyone gotten this to work, I am also using windows o/s on the galileo for iot.


Viewing all articles
Browse latest Browse all 18089

Trending Articles