无法连接到ubuntu 12.04中的蓝牙配件

时间:2013-01-20 05:50:08

标签: ubuntu bluetooth arduino

我正在尝试将运行ubuntu 12.04的笔记本电脑连接到连接到arduino的蓝牙伴侣银。

接线是:

CTS-I->No connection (leave floating)
VCC->5V
GND->GND
TX-O->D2
RX-I->D3
RTS-O->No connection (leave floating)

在arduino上运行的代码:

$include <SoftwareSerial.h>  

int bluetoothTx = 2;  // TX-O pin of bluetooth mate, Arduino D2
int bluetoothRx = 3;  // RX-I pin of bluetooth mate, Arduino D3

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup()
{
  Serial.begin(9600);  // Begin the serial monitor at 9600bps

  bluetooth.begin(115200);  // The Bluetooth Mate defaults to 115200bps
  bluetooth.print("$$$");  // Enter command mode
  delay(100);  // Short delay, wait for the Mate to send back CMD
  bluetooth.println("U,9600,N");  // Temporarily Change the baudrate to 9600, no parity
  // 115200 can be too fast at times for NewSoftSerial to relay the data reliably
  bluetooth.begin(9600);  // Start bluetooth serial at 9600
}

void loop()
{
  if(bluetooth.available())  // If the bluetooth sent any characters
  {
    // Send any characters the bluetooth prints to the serial monitor
    Serial.print((char)bluetooth.read());  
  }
  if(Serial.available())  // If stuff was typed in the serial monitor
  {
    // Send any characters the Serial monitor prints to the bluetooth
    bluetooth.print((char)Serial.read());
  }
  // and loop forever and ever!
}

当我在ubuntu中打开蓝牙管理器时,我发现蓝牙配合可见但未知,当我右键单击它时没有SPP连接选项。我通过SPP选项连接到蓝牙配对的所有教程和博客。

我的蓝牙管理员的照片:http://www2.picturepush.com/photo/a/12001550/640/12001550.jpg

那么我现在如何连接到蓝牙伴侣呢?

1 个答案:

答案 0 :(得分:1)

经过大量的谷歌搜索和阅读各种博客后,我遇到了这个命令:

    sudo rfcomm bind 0 00:06:66:48:71:0C

其中00:06:66:48:71:0C是蓝牙伴侣银的mac地址。

一旦我这样做,我发现蓝牙管理器中我的设备的串口选项已启用。 我继续从那里连接到设备。