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

Commit 805bec6

Browse files
authored
Removed gattlib from example code
1 parent 1a7e92c commit 805bec6

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

README.rst

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ Python SDK for creating MetaWear apps on the Linux platform. This is a thin wra
99

1010
Install
1111
#######
12-
Use pip to install the metawear package. It depends on `pygattlib <https://bitbucket.org/OscarAcena/pygattlib>`_ so ensure your Linux environment first has the necessary
13-
`dependencies <https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/DEPENDS?at=default&fileviewer=file-view-default>`_ installed.
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.
1413

1514
.. code-block:: bash
1615
17-
pip install metawear --process-dependency-links
16+
pip install metawear
1817
1918
Usage
2019
#####
@@ -25,23 +24,31 @@ Import the MetaWear class and libmetawear variable from the metawear module and
2524
from mbientlab.metawear import MetaWear, libmetawear
2625
from mbientlab.metawear.cbindings import *
2726
28-
If you do not know the MAC address of your device, use ``pygattlib`` to scan for nearby devices.
27+
If you do not know the MAC address of your device, use ``PyWarble`` to scan for nearby devices.
2928

3029
.. code-block:: python
3130
32-
from gattlib import DiscoveryService
33-
service = DiscoveryService("hci0")
34-
devices = service.discover(2)
35-
36-
# grab the first scanned device
37-
address = devices.items()[0][0]
38-
31+
from mbientlab.warble import *
32+
from threading import Event
33+
34+
e = Event()
35+
address = None
36+
def device_discover_task(result):
37+
global address
38+
# grab the first discoered device
39+
address = result.mac
40+
e.set()
41+
42+
BleScanner.set_handler(scan_result_printer)
43+
BleScanner.start()
44+
e.wait()
45+
3946
Once you have the device's MAC address, create a MetaWear object with the MAC address and connect to the device.
4047

4148
.. code-block:: python
4249
4350
device = MetaWear(address)
44-
status = device.connect()
51+
device.connect()
4552
4653
Upon a successful connection, you can begin calling any of the functions from the C++ SDK, for example, blinking the LED green.
4754

0 commit comments

Comments
 (0)