2018-08-15python通过蓝牙接megpi主板
电脑:thinkpad-E450带蓝牙
操作系統:ubuntu
主板:Megpi
蓝牙模块:蓝牙4.0
Application: Makeblock Bluetooth Module
Equipment Class: DXX - Part 15 Low Power Communication Device Transmitter
View FCC ID on FCC.gov:2ACWW13002
Registered By:HULU ROBOTICS TECHNOLOGY COMPANY LIMITED - 2ACWW (China)
一、蓝牙配置:
1、在Python环境下使用“import bluetooth”如果报出错误信息“ImportError: No module named bluetooth”则说明没有安装相应的包,执行以下命令安装。
$sudo apt-get update
$sudo apt-get install bluetooth bluez python-bluez
经测试,上述命令执行完,python2下可以使用import bluetooth但python3.5和python下不可以
2、python3下用如下命令
sudo pip3 install pybluez
注意:如果是Python3,必须pip3 ,前面一直用pip安装,一直不行,后面Google,pip3可以了
3、由于我的python是Anaconda下的,所以使用(未成功)
pip3 install -t /home/gameboy/anaconda3/lib/python3.6/site-packages bluetooth bluez python-bluez
出现的错误信息
Could not find a version that satisfies the requirement bluetooth (from versions: )
No matching distribution found for bluetooth
二、蓝牙python代码
1、pYbluez
bluetoothtest.py
2、github bluepy
https://blog.csdn.net/qq_18150497/article/details/51989161
test
3、serial
test