Skip to content

Commit a5ef231

Browse files
committed
aioble/README.md: Demostrate optional args to aioble.scan().
Adds missing "duration_ms" argument to the example, and a second example that shows the "interval_us" / "window_us" and also active scan. Signed-off-by: Jim Mussared <[email protected]>
1 parent 423f5fa commit a5ef231

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Diff for: micropython/bluetooth/aioble/README.md

+12-4
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,21 @@ Alternatively, install the `aioble` package, which will install everything.
7070
Usage
7171
-----
7272

73-
Scan for nearby devices: (Observer)
73+
Passive scan for nearby devices for 5 seconds: (Observer)
7474

7575
```py
76-
async with aioble.scan() as scanner:
76+
async with aioble.scan(duration_ms=5000) as scanner:
7777
async for result in scanner:
78-
if result.name():
79-
print(result, result.name(), result.rssi, result.services())
78+
print(result, result.name(), result.rssi, result.services())
79+
```
80+
81+
Active scan (includes "scan response" data) for nearby devices for 5 seconds
82+
with the highest duty cycle: (Observer)
83+
84+
```py
85+
async with aioble.scan(duration_ms=5000, interval_us=30000, window_us=30000, active=True) as scanner:
86+
async for result in scanner:
87+
print(result, result.name(), result.rssi, result.services())
8088
```
8189

8290
Connect to a peripheral device: (Central)

0 commit comments

Comments
 (0)