-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
win: duplicate doc files were intentional, restore them.
- Loading branch information
1 parent
7c54751
commit fb1d754
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Copyright 2020 MbientLab Inc. All rights reserved. | ||
|
||
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"). | ||
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. | ||
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. | ||
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. | ||
|
||
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. | ||
|
||
Should you have any questions regarding your right to use this Software, contact MbientLab via email: [email protected]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
MetaWear Python SDK | ||
################### | ||
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++ | ||
`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 | ||
`examples <https://github.com/mbientlab/MetaWear-SDK-Python/tree/master/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 <https://github.com/mbientlab-projects/pymetawear>`_ **.** | ||
|
||
Install | ||
####### | ||
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. | ||
|
||
.. code-block:: bash | ||
pip install metawear | ||
Usage | ||
##### | ||
Import the MetaWear class and libmetawear variable from the metawear module and everything from the cbindings module. | ||
|
||
.. code-block:: python | ||
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. | ||
|
||
.. code-block:: python | ||
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. | ||
|
||
.. code-block:: python | ||
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. | ||
|
||
.. code-block:: python | ||
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) | ||