PyMetaWear is a community developed Python SDK started by Henrik Blidh . MbientLab does not provide support for this SDK.
Python package for connecting to and using MbientLab’s MetaWear boards.
PyMetaWear can, from version 0.11.0, be used from both Windows and Linux. This is thanks to that the metawear package package is now depending on a new BLE library called PyWarble instead of gattlib. See installation instructions for more details about how to make it build on Windows.
Capabilities and Limitations
PyMetaWear was previously a wrapper around the MetaWear C++ API, providing a more Pythonic interface. In version 0.9.0 it instead becomes a wrapper around MetaWear’s official Python SDK, doing the very same thing. The official SDK handles the actual board connections and communication while PyMetaWear aims to remove the low level feeling of interacting with the MetaWear board.
Installation
$ pip install pymetawear
Since version 0.11.0, the installation requirements for pymetawear has changed. See documentation for details on requirements for Linux and Windows respectively.
Documentation
Available in the Github pages of this repository.
Basic Usage
The MetaWear client can be used in two ways: either as Pythonic convenience class for handling a MetaWear board or as a simple communication client governed by the libmetawear C++ library.
Creating a client, and thus also setting up a Bluetooth connection to the MetaWear board, is equal for both the two usage profiles:
from pymetawear.client import MetaWearClient
c = MetaWearClient('DD:3A:7D:4D:56:F0')
Example
Blinking with the LED lights can be done like this with the convenience methods:
pattern = c.led.load_preset_pattern('blink', repeat_count=10)
c.led.write_pattern(pattern, 'g')
c.led.play()
or like this using the raw libmetawear shared library:
from ctypes import byref
from pymetawear import libmetawear
from mbientlab.metawear.cbindings import LedColor, LedPreset
pattern = Led.Pattern(repeat_count=10)
libmetawear.mbl_mw_led_load_preset_pattern(byref(pattern), LedPreset.BLINK)
libmetawear.mbl_mw_led_write_pattern(c.board, byref(pattern), LedColor.GREEN)
libmetawear.mbl_mw_led_play(c.board)
Bluetooth Low Energy Scanning
Actual addresses to your MetaWear board can be found by scanning with the included discover_devices method:
from pymetawear.discover import discover_devices
out = discover_devices()
print(out)
[(u'DD:3A:7D:4D:56:F0', u'MetaWear'), (u'FF:50:35:82:3B:5A', u'MetaWear')]
See the examples folder for more examples on how to use the libmetawear library with this client.
Modules
All functionality of the MetaWear C++ API is able to be used using the PyMetaWear client, and some of the modules have had convenience methods added to simplify the use of them. Below is a list of modules which have had their convenience methods written and one of modules that are awaiting such focus.
Completed Modules |
Unimplemented Modules |
|---|---|
Accelerometer |
GPIO |
Gyroscope |
NeoPixel |
Haptic |
Color Detector |
Switch |
Humidity |
LED |
iBeacon |
Barometer |
I2C |
Magnetometer |
|
Temperature |
|
Settings |
|
Ambient Light |
Metadata
Release files for pymetawear 0.12.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pymetawear-0.12.0.tar.gz | 45.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pymetawear-0.12.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 83.8 kB
Release files / pymetawear-0.12.0.tar.gz
| Download URL | pymetawear-0.12.0.tar.gz |
|---|---|
| Size | 45.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ae2436fd8055d7e47c79a6695813816c83140b61a4e8aab8a24c52ea339259c
|
|
BLAKE2b-256 checksum How to use checksums |
9f9c812bd70f5b1f9aaac919fc54e9b1248f3c392eeff1105640c93e8619db7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.4
|
Release files / pymetawear-0.12.0-py3-none-any.whl
| Download URL | pymetawear-0.12.0-py3-none-any.whl |
|---|---|
| Size | 37.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49e8efe13288489e5b949576717d2966ca5ed61166147f991ce300bbb697acef
|
|
BLAKE2b-256 checksum How to use checksums |
65600d1b6c0b265d0f5c83297e04d36268228971ef069f3344e7012bc1a6d4e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.4
|
Security for pymetawear 0.12.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.