kopia lustrzana https://github.com/micropython/micropython-lib
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 <jim.mussared@gmail.com>pull/599/head
rodzic
423f5fa2c2
commit
a5ef231e7d
|
@ -70,12 +70,20 @@ Alternatively, install the `aioble` package, which will install everything.
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Scan for nearby devices: (Observer)
|
Passive scan for nearby devices for 5 seconds: (Observer)
|
||||||
|
|
||||||
```py
|
```py
|
||||||
async with aioble.scan() as scanner:
|
async with aioble.scan(duration_ms=5000) as scanner:
|
||||||
|
async for result in scanner:
|
||||||
|
print(result, result.name(), result.rssi, result.services())
|
||||||
|
```
|
||||||
|
|
||||||
|
Active scan (includes "scan response" data) for nearby devices for 5 seconds
|
||||||
|
with the highest duty cycle: (Observer)
|
||||||
|
|
||||||
|
```py
|
||||||
|
async with aioble.scan(duration_ms=5000, interval_us=30000, window_us=30000, active=True) as scanner:
|
||||||
async for result in scanner:
|
async for result in scanner:
|
||||||
if result.name():
|
|
||||||
print(result, result.name(), result.rssi, result.services())
|
print(result, result.name(), result.rssi, result.services())
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue