2017年11月2日 星期四

[LinkIt One]Bluebooth SPP 連線&傳輸

網路上找的小程式
#include <LBT.h>
#include <LBTServer.h>

#define btName "BT_SPP"

int i=0;

void setup() {
  // put your setup code here, to run once:
Serial.begin( 9600 );
while(!Serial);

pinMode(13,OUTPUT);

if(!LBTServer.begin((uint8_t*)btName))
{
  Serial.print("Fail to start BT\n");
  return;
}
Serial.print("BT server is started\n");

for(int i=0;i<3;i++)
{
  digitalWrite(13,HIGH);
  delay(300);
  digitalWrite(13,LOW);
  delay(300);
}
}

void loop() {
  // put your main code here, to run repeatedly:
uint8_t buf[64];
int bytesRead;

if(LBTServer.connected())
{
   
   bytesRead = LBTServer.readBytes(buf, 1);
   if(bytesRead)
   {
      Serial.printf("RECV DATA:%x\n",buf[0]); 
   }
   else
   {
      Serial.print("Connected\n"); 
   }
}
else
{
  Serial.printf("Not connected:%d\n",i++);
  LBTServer.accept(5);
}



將之前的 PC程式,修改client 端:
//PC write
 buffer[0] = 0x05;
perStream.Write(buffer, 0, 1);

感動勒....有通聯





2017年10月21日 星期六

[LinkIt One]播 MP3

找到的範例

http://yehnan.blogspot.tw/2015/03/linkit-onemp3.html

2017年10月16日 星期一

[Ubuntu]藍牙檔案傳輸教學

不錯的文章:

Ubuntu Linux 藍牙檔案傳輸教學:讓手機與電腦互相傳送檔案https://blog.gtwang.org/linux/ubuntu-linux-file-transfer-via-bluetooth-tutorial/

2017年10月13日 星期五

[Raspberry]Bluetooth pi 無法與收機connect

安裝 GUI的 bluetooth manage,操作後,還是無法 connect

放棄了...

How to enable Bluetooth on Jessie
https://www.linuxquestions.org/questions/debian-26/how-to-enable-bluetooth-on-jessie-4175592710/

2017年9月8日 星期五

[Raspberry]Bluetooth


照著抄寫,有一堆編譯錯誤,好像找不到,h檔似的,可是我都有include...不知哪邊有誤

照著如下進去,看似有點進展:

但是會有如下錯誤訊息:

好像沒找到lib似的..加入如下檔案

竟成功了....YA!!





不錯的資料

樹莓派中 USB 藍牙卡的驅動與設置
http://ruten-proteus.blogspot.tw/2014/07/Bluetooth-Kit-tutorial-01.html

Raspberry Pi 安裝 USB Bluetooth Dongle
http://tekibrain.blogspot.tw/2013/05/raspberry-pi-usb-bluetooth-dongle.html

Bluetooth - Installing and Using Bluetooth on the Raspberry Pi
https://thepihut.com/blogs/raspberry-pi-tutorials/17841464-bluetooth-installing-and-using-bluetooth-on-the-raspberry-pi

Bluetooth Commands
http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/bluetooth/bluetooth-commands

Raspberry Pi 安裝 BlueZ 支援藍牙 BLE 功能http://www.arthurtoday.com/2014/12/raspberry-pi-install-bluez-5-with-ble-support.html


Chapter 4. Bluetooth programming in C with BlueZhttps://people.csail.mit.edu/albert/bluez-intro/c404.html


關於藍牙裝置找尋(inquiry, scan)兩三事http://ops9.blogspot.tw/2013/09/inquiry-scan.html