Skip to content
This repository was archived by the owner on Jul 20, 2025. It is now read-only.

Commit fb1d754

Browse files
committed
win: duplicate doc files were intentional, restore them.
1 parent 7c54751 commit fb1d754

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

LICENSE.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Copyright 2020 MbientLab Inc. All rights reserved.
2+
3+
IMPORTANT: Your use of this Software is limited to those specific rights granted under the terms of a software license agreement between the user who downloaded the software, his/her employer (which must be your employer) and MbientLab Inc, (the "License").
4+
You may not use this Software unless you agree to abide by the terms of the License which can be found at www.mbientlab.com/terms.
5+
The License limits your use, and you acknowledge, that the Software may be modified, copied, and distributed when used in conjunction with an MbientLab Inc, product.
6+
Other than for the foregoing purpose, you may not use, reproduce, copy, prepare derivative works of, modify, distribute, perform, display or sell this Software and/or its documentation for any purpose.
7+
8+
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MBIENTLAB OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
9+
10+
Should you have any questions regarding your right to use this Software, contact MbientLab via email: [email protected].

README.rst

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
MetaWear Python SDK
2+
###################
3+
Python SDK for creating MetaWear apps on the Linux platform. This is a thin wrapper around the `MetaWear C++ API <https://github.com/mbientlab/MetaWear-SDK-Cpp>`_ so you will find the C++
4+
`documentation <https://mbientlab.com/cppdocs/latest/>`_ and `API reference <https://mbientlab.com/docs/metawear/cpp/latest/globals.html>`_ useful. Also, check out the scripts in the
5+
`examples <https://github.com/mbientlab/MetaWear-SDK-Python/tree/master/examples>`_ folder for full sample code.
6+
7+
**This is not the pymetawear package. That is a community developed Python SDK which you can find over**
8+
`here <https://github.com/mbientlab-projects/pymetawear>`_ **.**
9+
10+
Install
11+
#######
12+
Use pip to install the metawear package. It depends on `PyWarble <https://github.com/mbientlab/PyWarble>`_ so ensure your target environment has the necessary `dependencies <https://github.com/mbientlab/Warble#build>`_ installed.
13+
14+
.. code-block:: bash
15+
16+
pip install metawear
17+
18+
Usage
19+
#####
20+
Import the MetaWear class and libmetawear variable from the metawear module and everything from the cbindings module.
21+
22+
.. code-block:: python
23+
24+
from mbientlab.metawear import MetaWear, libmetawear
25+
from mbientlab.metawear.cbindings import *
26+
27+
If you do not know the MAC address of your device, use ``PyWarble`` to scan for nearby devices.
28+
29+
.. code-block:: python
30+
31+
from mbientlab.warble import *
32+
from mbientlab.metawear import *
33+
from threading import Event
34+
35+
e = Event()
36+
address = None
37+
def device_discover_task(result):
38+
global address
39+
if (result.has_service_uuid(MetaWear.GATT_SERVICE)):
40+
# grab the first discovered metawear device
41+
address = result.mac
42+
e.set()
43+
44+
BleScanner.set_handler(device_discover_task)
45+
BleScanner.start()
46+
e.wait()
47+
48+
BleScanner.stop()
49+
50+
Once you have the device's MAC address, create a MetaWear object with the MAC address and connect to the device.
51+
52+
.. code-block:: python
53+
54+
device = MetaWear(address)
55+
device.connect()
56+
57+
Upon a successful connection, you can begin calling any of the functions from the C++ SDK, for example, blinking the LED green.
58+
59+
.. code-block:: python
60+
61+
pattern= LedPattern(repeat_count= Const.LED_REPEAT_INDEFINITELY)
62+
libmetawear.mbl_mw_led_load_preset_pattern(byref(pattern), LedPreset.BLINK)
63+
libmetawear.mbl_mw_led_write_pattern(device.board, byref(pattern), LedColor.GREEN)
64+
libmetawear.mbl_mw_led_play(device.board)
65+

0 commit comments

Comments
 (0)