You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 20, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.rst
+19-12Lines changed: 19 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,12 +9,11 @@ Python SDK for creating MetaWear apps on the Linux platform. This is a thin wra
9
9
10
10
Install
11
11
#######
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
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.
14
13
15
14
.. code-block:: bash
16
15
17
-
pip install metawear --process-dependency-links
16
+
pip install metawear
18
17
19
18
Usage
20
19
#####
@@ -25,23 +24,31 @@ Import the MetaWear class and libmetawear variable from the metawear module and
25
24
from mbientlab.metawear import MetaWear, libmetawear
26
25
from mbientlab.metawear.cbindings import*
27
26
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.
29
28
30
29
.. code-block:: python
31
30
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
+
defdevice_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
+
39
46
Once you have the device's MAC address, create a MetaWear object with the MAC address and connect to the device.
40
47
41
48
.. code-block:: python
42
49
43
50
device = MetaWear(address)
44
-
status =device.connect()
51
+
device.connect()
45
52
46
53
Upon a successful connection, you can begin calling any of the functions from the C++ SDK, for example, blinking the LED green.
0 commit comments