Pycom WiPy 3.0 Manual page 301

Hide thumbs Also See for WiPy 3.0:
Table of Contents

Advertisement

5.2.2.3 Bluetooth
zero. If timeout is > 0, then the BLE radio will listen for advertisements until the specified
value in seconds elapses. If timeout < 0, then there's no timeout at all, and stop_scan()
needs to be called to cancel the scanning process.
Examples:
bluetooth.start_scan(10) # starts scanning and stop after 10 seconds
bluetooth.start_scan(-1) # starts scanning indefinitely until bluetooth.stop_sc
an() is called
bluetooth.stop_scan()
Stops an ongoing scanning process. Returns
bluetooth.isscanning()
Returns
if a Bluetooth scan is in progress.
True
bluetooth.get_adv()
Gets an named tuple with the advertisement data received during the scanning. The tuple
has the following structure:
is the 6-byte ling mac address of the device that sent the advertisement.
mac
is the address type. See the constants section below for more details.
addr_type
is the advertisement type received. See the constants section below fro more
adv_type
details.
is signed integer with the signal strength of the advertisement.
rssi
contains the complete 31 bytes of the advertisement message. In order to parse
data
the data and get the specific types, the method resolve_adv_data() can be used.
Example for getting
mac
import ubinascii
bluetooth = Bluetooth()
bluetooth.start_scan(20) # scan for 20 seconds
adv = bluetooth.get_adv() #
ubinascii.hexlify(adv.mac) # convert hexadecimal to ascii
bluetooth.get_advertisements()
Same as the
get_adv()
received.
(mac, addr_type, adv_type, rssi, data)
address of an advertiser:
method, but this one returns a list with all the advertisements
.
None
otherwise.
False
301

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the WiPy 3.0 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

SipyGpyLopyLopy4Fipy

Table of Contents