Skip to main content

MetaWear Python SDK

Python SDK for creating MetaWear apps on the Linux platform. This is a thin wrapper around the MetaWear C++ API so you will find the C++ documentation and API reference useful. Also, check out the scripts in the examples folder for full sample code.

This is not the pymetawear package. That is a community developed Python SDK which you can find over here .

Install

Use pip to install the metawear package. It depends on PyWarble so ensure your target environment has the necessary dependencies installed.

pip install metawear

Usage

Import the MetaWear class and libmetawear variable from the metawear module and everything from the cbindings module.

from mbientlab.metawear import MetaWear, libmetawear
from mbientlab.metawear.cbindings import *

If you do not know the MAC address of your device, use PyWarble to scan for nearby devices.

from mbientlab.warble import *
from mbientlab.metawear import *
from threading import Event

e = Event()
address = None
def device_discover_task(result):
    global address
    if (result.has_service_uuid(MetaWear.GATT_SERVICE)):
        # grab the first discovered metawear device
        address = result.mac
        e.set()

BleScanner.set_handler(device_discover_task)
BleScanner.start()
e.wait()

BleScanner.stop()

Once you have the device’s MAC address, create a MetaWear object with the MAC address and connect to the device.

device = MetaWear(address)
device.connect()

Upon a successful connection, you can begin calling any of the functions from the C++ SDK, for example, blinking the LED green.

pattern= LedPattern(repeat_count= Const.LED_REPEAT_INDEFINITELY)
libmetawear.mbl_mw_led_load_preset_pattern(byref(pattern), LedPreset.BLINK)
libmetawear.mbl_mw_led_write_pattern(device.board, byref(pattern), LedColor.GREEN)
libmetawear.mbl_mw_led_play(device.board)

Metadata

Release files for metawear 1.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metawear 1.0.8
File Size Uploaded Provenance Actions
metawear-1.0.8.tar.gz 658.0 kB Without provenance Details for metawear-1.0.8.tar.gz

Release files / metawear-1.0.8.tar.gz

Download URL metawear-1.0.8.tar.gz
Size 658.0 kB
Tags Source
SHA-256 checksum
How to use checksums
80d108e8fe86b2535dd43cc5c0216775521f52f4933d8a2594676a919850e18f
BLAKE2b-256 checksum
How to use checksums
2966f4fcc732da51431ef875a99b872ad27070c72d88533a01fe94463fec19e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.27.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3

Security for metawear 1.0.8

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page