** 刚刚开始接触如有错误请留言指正,多谢 **
设备
Raspberry Pi第三代B+版本
Arduino Pro Mini(5V,16MHz)w/ ATmega328 + 写入设备(或使用其他Arduino版本)
蓝牙HC-06
发光二极管1个
10千欧电阻1个
杜邦线若干
安装过程中所需要的包和工具
在 Python 环境下,使用“import bluetooth”如果报出错误信息“ImportError: No module named bluetooth”则说明没有安装相应的包,执行一下命令安装。
$ sudo apt-get update
$ sudo apt-get install bluetooth bluez python-bluez
连接蓝牙设备(Arduino)
使用下面的命令查看蓝牙的配置信息
$ hciconfig
使用下面的命令扫描可配对的设备
$ hcitool scan
进入$ bluetoothctl
[NEW] Controller B8:27:EB:D3:61:B0 raspberrypi [default]
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
//扫描可配对的设备
[bluetooth]# scan on
Discovery started
[CHG] Controller B8:27:EB:D3:61:B0 Discovering: yes
[NEW] Devi