#include <BLE.h>
void setup() {
ble.begin();
ble.startAdvert();
}
void loop() {
ble.handleEvents();
}
Starts advertising over BLE. This optionally takes a parameter of type
BLE_Advert_Settings. These
settings do not actually determine what is sent over the air, so this
function is independent of
ble.setAdvertName()
and
ble.setAdvertData()
(for advanced BLE users).
ble.startAdvert();
ble.startAdvert(&advertSettings);
&advertSettings: Pointer to an instance of BLE_Advert_Settings. If not provided, indefinite connectable advertising with a 100ms interval that stops during connection and restarts afterwards will be used.
Indefinite connectable advertising every 100ms that restarts on connection termination.
#include <BLE.h>
void setup() {
ble.begin();
ble.startAdvert();
}
void loop() {
ble.handleEvents();
}
Indefinite nonconnectable (e.g. for a simple beacon) advertisement every 900ms. Note that the last member, the connected behavior, of advertSettings has no effect because this is nonconnectable advertising.
#include <BLE.h>
BLE_Advert_Settings advertSettings =
{
BLE_ADV_MODE_NONCONN,
0,
1440, // 1440*0.625ms = 900ms
BLE_ADV_RESTART_ON_CONN_EST
}
void setup() {
ble.begin();
ble.startAdvert(&advertSettings);
}
void loop() {
ble.handleEvents();
}