ATTYS数据框的API(www.attys.tech)
pyattyscomm的Python项目详细描述
ATTYS是一个轻便的蓝牙数据采集盒,可以测量从温度到心电图的任何东西。
Linux下的必需软件包
为ubuntu linux安装libbluetooth dev:
sudo apt-get install libbluetooth-dev
对于其他Linux风格,请从souce安装:
快速入门指南
下面是使用api的基本步骤:
# load the module import pyattyscomm # Gets the AttysScan class which scans for Attys via bluetooth s = pyattyscomm.AttysScan() # Scan for Attys s.scan() # get the 1st Attys c = s.getAttysComm(0) # if an attys has been found c points to it. Otherwise it's None. # Start data acquisition in the background c.start() # Now we just read data at our convenience in a loop or timer or thread # if data is available you can read it from the ringBuffer while (not c.hasSampleAvilabale()): # do something else or nothing # getting a sample (array of all Attys channels) sample = c.getSampleFromBuffer() # do something with the sample print(sample) # rinse and repeat!
API文档
通过python帮助系统查询:
import pyattyscomm help(pyattyscomm.AttysScan) help(pyattyscomm.AttysComm)
python类是用swig生成的。头文件attyscomm.h和attysscan.h提供了有关类的详细信息:
演示
在github上有两个python演示:一个用于打印 屏幕上的ADC数据和两个绘图演示。