首页 > 编程语言 > 详细

Python adn Bluetooth

时间:2019-04-15 21:35:19      阅读:198      评论:0      收藏:0      [点我收藏+]

环境

Windows7-64bit + Python2.7.15-64bit + Pybluez

安装pybluez时会报错,处理方法~

1.安装VCForPython27.msi,这是为了提供visual c++ 9.0运行环境

2.C:\Program Files (x86)\Microsoft SDKs\Windows\  目录中 V7.0A 改为 V6.0A

重新pip2 install pybluez,很快就完成环境安装

PyBluez

A Python Bluetooth library for the Windows and GNU/Linux operating systems. Mac OSX and Linux Python are supported by LightBlue, a number of cell phones running the Symbian OS are supported under Python. The following examples use the PyBluez bluetooth library.

翻译成中文意思大概就是:Linux和Windows系统都能使用这个python蓝牙库,其中Mac和Linux还可以支持LightBlue这个库,部分塞班(Symbian)系统也支持蓝牙库pybluez

查看周围蓝牙设备

from bluetooth import *

print "performing inquiry..."

nearby_devices = discover_devices(lookup_names = True)

print "found %d devices" % len(nearby_devices)

for name, addr in nearby_devices:
     print " %s - %s" % (addr, name)

 

Python adn Bluetooth

原文:https://www.cnblogs.com/YangARTuan/p/10713086.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!