Skip to content

Commit 630b949

Browse files
authored
Merge pull request #153 from adafruit/tannewt-patch-1
Add simple advertising test
2 parents a0433b3 + aefb063 commit 630b949

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# SPDX-FileCopyrightText: 2022 Scott Shawcroft for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
4+
"""
5+
Simple connectable name advertisement. No services.
6+
"""
7+
8+
from adafruit_ble import BLERadio
9+
10+
from adafruit_ble.advertising import Advertisement
11+
12+
ble = BLERadio()
13+
advertisement = Advertisement()
14+
advertisement.short_name = "HELLO"
15+
advertisement.connectable = True
16+
17+
while True:
18+
print(advertisement)
19+
ble.start_advertising(advertisement, scan_response=b"")
20+
while not ble.connected:
21+
pass
22+
print("connected")
23+
while ble.connected:
24+
pass
25+
print("disconnected")

0 commit comments

Comments
 (0)